Versions in this module Expand all Collapse all v0 v0.1.1 Aug 24, 2023 Changes in this version + func CopyFile(fsys FileSystem, oldName, newName string) error + func CopyFileRange(src File, srcOffset int64, dst File, dstOffset int64, length int) (int, error) type File + CopyFileRange func(srcOffset int64, dst File, dstOffset int64, length int) (int, error) + type LookupFlags int + func (lf LookupFlags) OpenFlags() OpenFlags + func (lf LookupFlags) String() string + type OpenFlags int + func (of OpenFlags) LookupFlags() LookupFlags + func (of OpenFlags) String() string + type RenameFlags int + const RENAME_EXCHANGE + const RENAME_NOREPLACE + func (rf RenameFlags) String() string v0.1.0 Aug 9, 2023 Changes in this version + const AT_SYMLINK_NOFOLLOW + const DT_BLK + const DT_CHR + const DT_DIR + const DT_FIFO + const DT_LNK + const DT_REG + const DT_SOCK + const DT_UNKNOWN + const EADDRNOTAVAIL + const EAFNOSUPPORT + const EAGAIN + const EBADF + const ECONNABORTED + const ECONNREFUSED + const ECONNRESET + const EEXIST + const EHOSTUNREACH + const EINPROGRESS + const EINTR + const EINVAL + const EISCONN + const EISDIR + const ELOOP + const ENAMETOOLONG + const ENETUNREACH + const ENOENT + const ENOPROTOOPT + const ENOSYS + const ENOTCONN + const ENOTDIR + const ENOTEMPTY + const EOPNOTSUPP + const EPERM + const EPROTONOSUPPORT + const EPROTOTYPE + const EROFS + const ETIMEDOUT + const EXDEV + const MaxFollowSymlink + const O_APPEND + const O_CREAT + const O_DIRECTORY + const O_DSYNC — darwin/amd64, linux/amd64 + const O_EXCL + const O_NOFOLLOW + const O_NONBLOCK + const O_RDONLY + const O_RDWR + const O_RSYNC — darwin/amd64, linux/amd64 + const O_SYNC + const O_TRUNC + const O_WRONLY + const PATH_MAX — darwin/amd64, linux/amd64 + const PEEK + const SEEK_CUR + const SEEK_END + const SEEK_SET + const SHUTRD + const SHUTWR + const TRUNC + const UTIME_NOW — darwin/amd64, linux/amd64 + const UTIME_OMIT — darwin/amd64, linux/amd64 + const WAITALL + var ErrIPAM = errors.New("IP pool exhausted") + var ErrInterfaceNotFound = errors.New("network interface not found") + func FS(fsys FileSystem) fs.FS + func Link(fsys FileSystem, oldName, newName string) error + func Mkdir(fsys FileSystem, name string, mode fs.FileMode) error + func MkdirAll(fsys FileSystem, name string, mode fs.FileMode) error + func ReadDirent(buf []byte) (n int, typ fs.FileMode, ino, off uint64, name []byte, err error) + func ReadFile(fsys FileSystem, name string, flags int) ([]byte, error) + func Readlink(fsys FileSystem, name string) (string, error) + func Rename(fsys FileSystem, oldName, newName string) error + func ResolvePath(dir File, name string, flags int, do func(File, string) (R, error)) (ret R, err error) + func Rmdir(fsys FileSystem, name string) error + func SockaddrAddr(sa Sockaddr) netip.Addr + func SockaddrAddrPort(sa Sockaddr) netip.AddrPort + func Symlink(fsys FileSystem, oldName, newName string) error + func ThrottleFS(f wasiFS, r, w *rate.Limiter) wasiFS + func Unlink(fsys FileSystem, name string) error + func WriteDirent(buf []byte, typ fs.FileMode, ino, off uint64, name string) int + func WriteFile(fsys FileSystem, name string, data []byte, mode fs.FileMode) error + type Family uint8 + const INET + const INET6 + const UNIX + func SockaddrFamily(sa Sockaddr) Family + func (f Family) String() string + type File interface + Allocate func(offset, length int64) error + Chtimes func(name string, times [2]Timespec, flags int) error + Close func() error + Datasync func() error + Fd func() uintptr + Flags func() (int, error) + Link func(oldName string, newDir File, newName string, flags int) error + Mkdir func(name string, mode fs.FileMode) error + Name func() string + Open func(name string, flags int, mode fs.FileMode) (File, error) + Preadv func(iovs [][]byte, offset int64) (int, error) + Pwritev func(iovs [][]byte, offset int64) (int, error) + ReadDirent func(buf []byte) (int, error) + Readlink func(name string, buf []byte) (int, error) + Readv func(iovs [][]byte) (int, error) + Rename func(oldName string, newDir File, newName string) error + Rmdir func(name string) error + Seek func(offset int64, whence int) (int64, error) + SetFlags func(flags int) error + Stat func(name string, flags int) (FileInfo, error) + Symlink func(oldName, newName string) error + Sync func() error + Truncate func(size int64) error + Unlink func(name string) error + Writev func(iovs [][]byte) (int, error) + func Create(fsys FileSystem, name string, mode fs.FileMode) (File, error) + func Open(fsys FileSystem, name string) (File, error) + func OpenDir(fsys FileSystem, name string) (File, error) + func OpenRoot(fsys FileSystem) (File, error) + type FileInfo struct + Atime Timespec + Ctime Timespec + Dev uint64 + Gid uint32 + Ino uint64 + Mode fs.FileMode + Mtime Timespec + Nlink uint64 + Size int64 + Uid uint32 + func Lstat(fsys FileSystem, name string) (FileInfo, error) + func Stat(fsys FileSystem, name string) (FileInfo, error) + func (info FileInfo) String() string + type FileSystem interface + Open func(name string, flags int, mode fs.FileMode) (File, error) + func DirFS(path string) FileSystem + func RootFS(fsys FileSystem) FileSystem + type Interface interface + Addrs func() ([]net.Addr, error) + Flags func() net.Flags + HardwareAddr func() net.HardwareAddr + Index func() int + MTU func() int + MulticastAddrs func() ([]net.Addr, error) + Name func() string + type LocalNamespace struct + func (ns *LocalNamespace) Detach() + func (ns *LocalNamespace) InterfaceByIndex(index int) (Interface, error) + func (ns *LocalNamespace) InterfaceByName(name string) (Interface, error) + func (ns *LocalNamespace) Interfaces() ([]Interface, error) + func (ns *LocalNamespace) Socket(family Family, socktype Socktype, protocol Protocol) (Socket, error) + type LocalNetwork struct + func NewLocalNetwork(addrs ...netip.Prefix) *LocalNetwork + func (n *LocalNetwork) CreateNamespace(host Namespace, opts ...LocalOption) (*LocalNamespace, error) + type LocalOption func(*LocalNamespace) + func DialFunc(dial func(context.Context, string, string) (net.Conn, error)) LocalOption + func ListenFunc(listen func(context.Context, string, string) (net.Listener, error)) LocalOption + func ListenPacketFunc(listenPacket func(context.Context, string, string) (net.PacketConn, error)) LocalOption + type Namespace interface + InterfaceByIndex func(index int) (Interface, error) + InterfaceByName func(name string) (Interface, error) + Interfaces func() ([]Interface, error) + Socket func(family Family, socktype Socktype, protocol Protocol) (Socket, error) + func Host() Namespace + type Option func(*System) + func Args(args ...string) Option + func Environ(environ ...string) Option + func MaxOpenDirs(n int) Option + func MaxOpenFiles(n int) Option + func Mount(path string, fsys FileSystem) Option + func Network(ns Namespace) Option + func Rand(rand io.Reader) Option + func Resolver(rslv ServiceResolver) Option + func Time(time func() time.Time) Option + type Protocol uint16 + const NOPROTO + const TCP + const UDP + func (p Protocol) String() string + type ServiceResolver interface + LookupIP func(ctx context.Context, network, hostname string) ([]net.IP, error) + LookupPort func(ctx context.Context, network, service string) (int, error) + type Sockaddr = unix.Sockaddr + func SockaddrFromAddrPort(addrPort netip.AddrPort) Sockaddr + type SockaddrInet4 = unix.SockaddrInet4 + type SockaddrInet6 = unix.SockaddrInet6 + type SockaddrUnix = unix.SockaddrUnix + type Socket interface + Accept func() (Socket, Sockaddr, error) + Bind func(addr Sockaddr) error + Close func() error + Connect func(addr Sockaddr) error + Error func() error + Family func() Family + Fd func() uintptr + File func() *os.File + IsListening func() (bool, error) + IsNonBlock func() (bool, error) + Listen func(backlog int) error + Name func() (Sockaddr, error) + Peer func() (Sockaddr, error) + RecvBuffer func() (int, error) + RecvFrom func(iovs [][]byte, flags int) (n, rflags int, addr Sockaddr, err error) + RecvTimeout func() (time.Duration, error) + SendBuffer func() (int, error) + SendTimeout func() (time.Duration, error) + SendTo func(iovs [][]byte, addr Sockaddr, flags int) (int, error) + SetNonBlock func(nonblock bool) error + SetRecvBuffer func(size int) error + SetRecvTimeout func(timeout time.Duration) error + SetSendBuffer func(size int) error + SetSendTimeout func(timeout time.Duration) error + SetTCPNoDelay func(nodelay bool) error + SetTLSServerName func(serverName string) error + Shutdown func(how int) error + TCPNoDelay func() (bool, error) + Type func() Socktype + type Socktype uint8 + const DGRAM + const STREAM + type System struct + func New(opts ...Option) *System + func NewSystem(opts ...Option) (*System, error) + func (s *System) ArgsGet(ctx context.Context) ([]string, wasi.Errno) + func (s *System) ArgsSizesGet(ctx context.Context) (argCount, stringBytes int, errno wasi.Errno) + func (s *System) ClockResGet(ctx context.Context, id wasi.ClockID) (wasi.Timestamp, wasi.Errno) + func (s *System) ClockTimeGet(ctx context.Context, id wasi.ClockID, precision wasi.Timestamp) (wasi.Timestamp, wasi.Errno) + func (s *System) Close(ctx context.Context) error + func (s *System) Dial(ctx context.Context, network, address string) (net.Conn, error) + func (s *System) EnvironGet(ctx context.Context) ([]string, wasi.Errno) + func (s *System) EnvironSizesGet(ctx context.Context) (envCount, stringBytes int, errno wasi.Errno) + func (s *System) FDAdvise(ctx context.Context, fd wasi.FD, offset, length wasi.FileSize, ...) wasi.Errno + func (s *System) FDAllocate(ctx context.Context, fd wasi.FD, offset, length wasi.FileSize) wasi.Errno + func (s *System) FDClose(ctx context.Context, fd wasi.FD) wasi.Errno + func (s *System) FDDataSync(ctx context.Context, fd wasi.FD) wasi.Errno + func (s *System) FDFileStatGet(ctx context.Context, fd wasi.FD) (wasi.FileStat, wasi.Errno) + func (s *System) FDFileStatSetSize(ctx context.Context, fd wasi.FD, size wasi.FileSize) wasi.Errno + func (s *System) FDFileStatSetTimes(ctx context.Context, fd wasi.FD, accessTime, modifyTime wasi.Timestamp, ...) wasi.Errno + func (s *System) FDPreStatDirName(ctx context.Context, fd wasi.FD) (string, wasi.Errno) + func (s *System) FDPreStatGet(ctx context.Context, fd wasi.FD) (wasi.PreStat, wasi.Errno) + func (s *System) FDPread(ctx context.Context, fd wasi.FD, iovs []wasi.IOVec, offset wasi.FileSize) (wasi.Size, wasi.Errno) + func (s *System) FDPwrite(ctx context.Context, fd wasi.FD, iovs []wasi.IOVec, offset wasi.FileSize) (wasi.Size, wasi.Errno) + func (s *System) FDRead(ctx context.Context, fd wasi.FD, iovs []wasi.IOVec) (wasi.Size, wasi.Errno) + func (s *System) FDReadDir(ctx context.Context, fd wasi.FD, entries []wasi.DirEntry, ...) (int, wasi.Errno) + func (s *System) FDRenumber(ctx context.Context, from, to wasi.FD) wasi.Errno + func (s *System) FDSeek(ctx context.Context, fd wasi.FD, offset wasi.FileDelta, whence wasi.Whence) (wasi.FileSize, wasi.Errno) + func (s *System) FDStatGet(ctx context.Context, fd wasi.FD) (wasi.FDStat, wasi.Errno) + func (s *System) FDStatSetFlags(ctx context.Context, fd wasi.FD, flags wasi.FDFlags) wasi.Errno + func (s *System) FDStatSetRights(ctx context.Context, fd wasi.FD, rightsBase, rightsInheriting wasi.Rights) wasi.Errno + func (s *System) FDSync(ctx context.Context, fd wasi.FD) wasi.Errno + func (s *System) FDTell(ctx context.Context, fd wasi.FD) (wasi.FileSize, wasi.Errno) + func (s *System) FDWrite(ctx context.Context, fd wasi.FD, iovs []wasi.IOVec) (wasi.Size, wasi.Errno) + func (s *System) Kill() + func (s *System) Listen(ctx context.Context, network, address string) (net.Listener, error) + func (s *System) ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error) + func (s *System) PathCreateDirectory(ctx context.Context, fd wasi.FD, path string) wasi.Errno + func (s *System) PathFileStatGet(ctx context.Context, fd wasi.FD, lookupFlags wasi.LookupFlags, path string) (wasi.FileStat, wasi.Errno) + func (s *System) PathFileStatSetTimes(ctx context.Context, fd wasi.FD, lookupFlags wasi.LookupFlags, path string, ...) wasi.Errno + func (s *System) PathLink(ctx context.Context, oldFD wasi.FD, oldFlags wasi.LookupFlags, oldPath string, ...) wasi.Errno + func (s *System) PathOpen(ctx context.Context, fd wasi.FD, dirFlags wasi.LookupFlags, path string, ...) (wasi.FD, wasi.Errno) + func (s *System) PathReadLink(ctx context.Context, fd wasi.FD, path string, buffer []byte) (int, wasi.Errno) + func (s *System) PathRemoveDirectory(ctx context.Context, fd wasi.FD, path string) wasi.Errno + func (s *System) PathRename(ctx context.Context, fd wasi.FD, oldPath string, newFD wasi.FD, newPath string) wasi.Errno + func (s *System) PathSymlink(ctx context.Context, oldPath string, fd wasi.FD, newPath string) wasi.Errno + func (s *System) PathUnlinkFile(ctx context.Context, fd wasi.FD, path string) wasi.Errno + func (s *System) PollOneOff(ctx context.Context, subscriptions []wasi.Subscription, events []wasi.Event) (int, wasi.Errno) + func (s *System) PreopenFD(fd wasi.FD) + func (s *System) ProcExit(ctx context.Context, code wasi.ExitCode) wasi.Errno + func (s *System) ProcRaise(ctx context.Context, signal wasi.Signal) wasi.Errno + func (s *System) RandomGet(ctx context.Context, b []byte) wasi.Errno + func (s *System) SchedYield(ctx context.Context) wasi.Errno + func (s *System) SockAccept(ctx context.Context, fd wasi.FD, flags wasi.FDFlags) (wasi.FD, wasi.SocketAddress, wasi.SocketAddress, wasi.Errno) + func (s *System) SockAddressInfo(ctx context.Context, name, service string, hints wasi.AddressInfo, ...) (int, wasi.Errno) + func (s *System) SockBind(ctx context.Context, fd wasi.FD, addr wasi.SocketAddress) (wasi.SocketAddress, wasi.Errno) + func (s *System) SockConnect(ctx context.Context, fd wasi.FD, peer wasi.SocketAddress) (wasi.SocketAddress, wasi.Errno) + func (s *System) SockGetOpt(ctx context.Context, fd wasi.FD, option wasi.SocketOption) (wasi.SocketOptionValue, wasi.Errno) + func (s *System) SockListen(ctx context.Context, fd wasi.FD, backlog int) wasi.Errno + func (s *System) SockLocalAddress(ctx context.Context, fd wasi.FD) (wasi.SocketAddress, wasi.Errno) + func (s *System) SockOpen(ctx context.Context, pf wasi.ProtocolFamily, st wasi.SocketType, ...) (wasi.FD, wasi.Errno) + func (s *System) SockRecv(ctx context.Context, fd wasi.FD, iovecs []wasi.IOVec, flags wasi.RIFlags) (wasi.Size, wasi.ROFlags, wasi.Errno) + func (s *System) SockRecvFrom(ctx context.Context, fd wasi.FD, iovecs []wasi.IOVec, flags wasi.RIFlags) (wasi.Size, wasi.ROFlags, wasi.SocketAddress, wasi.Errno) + func (s *System) SockRemoteAddress(ctx context.Context, fd wasi.FD) (wasi.SocketAddress, wasi.Errno) + func (s *System) SockSend(ctx context.Context, fd wasi.FD, iovecs []wasi.IOVec, flags wasi.SIFlags) (wasi.Size, wasi.Errno) + func (s *System) SockSendTo(ctx context.Context, fd wasi.FD, iovecs []wasi.IOVec, flags wasi.SIFlags, ...) (wasi.Size, wasi.Errno) + func (s *System) SockSetOpt(ctx context.Context, fd wasi.FD, option wasi.SocketOption, ...) wasi.Errno + func (s *System) SockShutdown(ctx context.Context, fd wasi.FD, flags wasi.SDFlags) wasi.Errno + func (s *System) Stderr() io.ReadCloser + func (s *System) Stdin() io.WriteCloser + func (s *System) Stdout() io.ReadCloser + type Timespec = unix.Timespec + func TimeToTimespec(t time.Time) Timespec + type Timeval = unix.Timeval