generate and maintain resolv.conf for sandbox

Signed-off-by: Crazykev <crazykev@zju.edu.cn>
This commit is contained in:
Crazykev
2017-05-24 15:38:42 +08:00
parent d0949687b4
commit 9bf7ffd51a
7 changed files with 99 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ package os
import (
"io"
"io/ioutil"
"os"
"golang.org/x/net/context"
@@ -33,6 +34,7 @@ type OS interface {
OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error)
Stat(name string) (os.FileInfo, error)
CopyFile(src, dest string, perm os.FileMode) error
WriteFile(filename string, data []byte, perm os.FileMode) error
}
// RealOS is used to dispatch the real system level operations.
@@ -75,3 +77,8 @@ func (RealOS) CopyFile(src, dest string, perm os.FileMode) error {
_, err = io.Copy(out, in)
return err
}
// WriteFile will call ioutil.WriteFile to write data into a file.
func (RealOS) WriteFile(filename string, data []byte, perm os.FileMode) error {
return ioutil.WriteFile(filename, data, perm)
}