net

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: GPL-3.0, Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetHostAcceptedFD

func SetHostAcceptedFD(fd int32)

func SetHostDialedFD

func SetHostDialedFD(fd int32)

Types

type Conn

type Conn interface {
	net.Conn
	syscall.Conn
	SetNonBlock(nonblocking bool) error
	Fd() int32
}

Conn is the interface for a generic stream-oriented network connection.

func Dial

func Dial(_, _ string) (Conn, error)

Dial dials a remote host for a network connection.

In v0, network and address parameters are ignored, and it is internally called as HostManagedDial.

func HostManagedAccept

func HostManagedAccept() (Conn, error)

HostManagedAccept asks the host to accept a connection.

func HostManagedDial

func HostManagedDial() (Conn, error)

HostManagedDial asks the host to dial a remote host predefined by the host.

type Listener

type Listener interface {
	Accept() (Conn, error)
}

Listener is the interface for a generic network listener.

type TCPConn

type TCPConn struct {
	// contains filtered or unexported fields
}

TCPConn is a wrapper around a file descriptor that implements the net.Conn.

Despite the name, this type is not specific to TCP connections. It can be used for any file descriptor that is connection-oriented.

func RebuildTCPConn

func RebuildTCPConn(fd int32) *TCPConn

RebuildTCPConn recovers a TCPConn from a file descriptor.

func (*TCPConn) Close

func (c *TCPConn) Close() error

Close implements net.Conn.Close.

func (*TCPConn) Fd

func (c *TCPConn) Fd() int32

Fd returns the file descriptor of the socket.

func (*TCPConn) LocalAddr

func (c *TCPConn) LocalAddr() net.Addr

LocalAddr implements net.Conn.LocalAddr.

This function is currently not implemented, but may be fleshed out in the future should there be better support for getting the local address of a socket managed by the Go runtime.

func (*TCPConn) Read

func (c *TCPConn) Read(b []byte) (n int, err error)

Read implements net.Conn.Read.

func (*TCPConn) RemoteAddr

func (c *TCPConn) RemoteAddr() net.Addr

RemoteAddr implements net.Conn.RemoteAddr.

This function is currently not implemented, but may be fleshed out in the future should there be better support for getting the remote address of a socket managed by the Go runtime.

func (*TCPConn) SetDeadline

func (c *TCPConn) SetDeadline(t time.Time) error

SetDeadline implements net.Conn.SetDeadline.

func (*TCPConn) SetNonBlock

func (c *TCPConn) SetNonBlock(nonblocking bool) error

SetNonBlock sets the socket to blocking or non-blocking mode.

func (*TCPConn) SetReadDeadline

func (c *TCPConn) SetReadDeadline(t time.Time) error

SetReadDeadline implements net.Conn.SetReadDeadline.

func (*TCPConn) SetWriteDeadline

func (c *TCPConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements net.Conn.SetWriteDeadline.

func (*TCPConn) SyscallConn

func (c *TCPConn) SyscallConn() (syscall.RawConn, error)

SyscallConn implements syscall.Conn.

func (*TCPConn) Write

func (c *TCPConn) Write(b []byte) (n int, writeErr error)

Write implements net.Conn.Write.

type TCPListener

type TCPListener struct {
}

TCPListener is a fake TCP listener which calls to the host to accept a connection.

By saying "fake", it means that the file descriptor is not managed inside the WATM, but by the host application.

func (*TCPListener) Accept

func (l *TCPListener) Accept() (Conn, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL