net

package
v0.0.0-...-a2b917b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidNet = errors.New("receiver does not implement net.Net")

Functions

func NewListener

func NewListener(s Server, l net.Listener) (*listener, error)

Types

type Address

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

func NewAddress

func NewAddress(in isolates.FunctionArgs) (*Address, error)

func (*Address) Address

func (a *Address) Address() string

func (*Address) Family

func (a *Address) Family() string

func (*Address) Port

func (a *Address) Port() int

func (*Address) V8GetAddress

func (a *Address) V8GetAddress(in isolates.GetterArgs) (*isolates.Value, error)

func (*Address) V8GetFamily

func (a *Address) V8GetFamily(in isolates.GetterArgs) (*isolates.Value, error)

func (*Address) V8GetPort

func (a *Address) V8GetPort(in isolates.GetterArgs) (*isolates.Value, error)

type ConnectOptions

type ConnectOptions struct {
	Port         int       `v8:"port"`
	Host         *string   `v8:"host"`
	LocalAddress *string   `v8:"localAddress"`
	LocalPort    *int      `v8:"localPort"`
	Family       *IPFamily `v8:"family"`
}

type DeferredTCPConn

type DeferredTCPConn struct {
	sync.Mutex
	*gonet.TCPConn
	// contains filtered or unexported fields
}

func (*DeferredTCPConn) Close

func (c *DeferredTCPConn) Close() error

func (*DeferredTCPConn) CloseWrite

func (c *DeferredTCPConn) CloseWrite() error

func (*DeferredTCPConn) Read

func (c *DeferredTCPConn) Read(b []byte) (int, error)

func (*DeferredTCPConn) SetTCPConn

func (c *DeferredTCPConn) SetTCPConn(t *gonet.TCPConn) error

func (*DeferredTCPConn) Wait

func (c *DeferredTCPConn) Wait()

func (*DeferredTCPConn) Write

func (c *DeferredTCPConn) Write(b []byte) (int, error)

type HostNetOptions

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

func NewHostNetOptions

func NewHostNetOptions(in isolates.FunctionArgs) (*HostNetOptions, error)

func (*HostNetOptions) Connect

func (n *HostNetOptions) Connect(in isolates.FunctionArgs, net Net, network string, address string) (Socket, error)

func (*HostNetOptions) Listen

func (n *HostNetOptions) Listen(in isolates.FunctionArgs, server Server, network string, address string) (Listener, error)

func (*HostNetOptions) V8FuncConnect

func (n *HostNetOptions) V8FuncConnect(in isolates.FunctionArgs) (*isolates.Value, error)

func (*HostNetOptions) V8FuncListen

func (n *HostNetOptions) V8FuncListen(in isolates.FunctionArgs) (*isolates.Value, error)

type HostSocketOptions

type HostSocketOptions struct {
	*stream.ReadWriteCloser
	// contains filtered or unexported fields
}

func NewHostSocketOptions

func NewHostSocketOptions(in isolates.FunctionArgs) (*HostSocketOptions, error)

func (*HostSocketOptions) Final

func (c *HostSocketOptions) Final(in isolates.FunctionArgs, this stream.Writable, callback *isolates.Value) error

func (*HostSocketOptions) LocalAddress

func (c *HostSocketOptions) LocalAddress(ctx context.Context, this *SocketBase) (*Address, error)

func (*HostSocketOptions) RemoteAddress

func (c *HostSocketOptions) RemoteAddress(ctx context.Context, this *SocketBase) (*Address, error)

func (*HostSocketOptions) V8FuncFinal

func (c *HostSocketOptions) V8FuncFinal(in isolates.FunctionArgs) (*isolates.Value, error)

func (*HostSocketOptions) V8FuncLocalAddress

func (c *HostSocketOptions) V8FuncLocalAddress(in isolates.FunctionArgs) (*isolates.Value, error)

func (*HostSocketOptions) V8FuncRemoteAddress

func (c *HostSocketOptions) V8FuncRemoteAddress(in isolates.FunctionArgs) (*isolates.Value, error)

type IPFamily

type IPFamily int
const (
	AnyFamily IPFamily = 0
	IPv4      IPFamily = 4
	IPv6      IPFamily = 6
)

type ITCPConn

type ITCPConn interface {
	CloseWrite() error
}

type Listener

type Listener interface {
	Close(ctx context.Context) error
	Address(ctx context.Context) (*Address, error)
}

type Net

type Net interface {
	Server() *isolates.Value
	Socket() *isolates.Value
	Connect(ctx context.Context, network string, address string) (*isolates.Value, error)
	Listen(ctx context.Context, server Server, network string, address string) (*isolates.Value, error)
}

type NetBase

type NetBase struct {
	This *isolates.Value
	// contains filtered or unexported fields
}

func NewHostNet

func NewHostNet(ctx context.Context) (*NetBase, error)

func NewNet

func NewNet(in isolates.FunctionArgs) (*NetBase, error)

func (*NetBase) Connect

func (n *NetBase) Connect(ctx context.Context, network, address string) (*isolates.Value, error)

func (*NetBase) Listen

func (n *NetBase) Listen(ctx context.Context, server Server, network, address string) (*isolates.Value, error)

func (*NetBase) Server

func (n *NetBase) Server() *isolates.Value

func (*NetBase) Socket

func (n *NetBase) Socket() *isolates.Value

type Server

type Server interface {
	events.EventEmitter
	Listener
	Net() Net
}

type ServerBase

type ServerBase struct {
	*events.EventEmitterBase
	// contains filtered or unexported fields
}

func (*ServerBase) Address

func (s *ServerBase) Address(ctx context.Context) (*Address, error)

func (*ServerBase) Close

func (s *ServerBase) Close(ctx context.Context) error

func (*ServerBase) Listen

func (s *ServerBase) Listen(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ServerBase) Listener

func (s *ServerBase) Listener() *isolates.Value

func (*ServerBase) Net

func (s *ServerBase) Net() Net

func (*ServerBase) V8FuncAddress

func (s *ServerBase) V8FuncAddress(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ServerBase) V8FuncClose

func (s *ServerBase) V8FuncClose(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ServerBase) V8FuncListen

func (s *ServerBase) V8FuncListen(in isolates.FunctionArgs) (*isolates.Value, error)

func (*ServerBase) V8Get_listener

func (s *ServerBase) V8Get_listener(in isolates.GetterArgs) (*isolates.Value, error)

type Socket

type Socket interface {
	stream.Duplex
}

type SocketBase

type SocketBase struct {
	*stream.DuplexBase
}

func (*SocketBase) Address

func (s *SocketBase) Address(ctx context.Context) (*Address, error)

func (*SocketBase) LocalAddress

func (s *SocketBase) LocalAddress(ctx context.Context) (*string, error)

func (*SocketBase) LocalFamily

func (s *SocketBase) LocalFamily(ctx context.Context) (*string, error)

func (*SocketBase) LocalPort

func (s *SocketBase) LocalPort(ctx context.Context) (*int, error)

func (*SocketBase) RemoteAddress

func (s *SocketBase) RemoteAddress(ctx context.Context) (*string, error)

func (*SocketBase) RemoteFamily

func (s *SocketBase) RemoteFamily(ctx context.Context) (*string, error)

func (*SocketBase) RemotePort

func (s *SocketBase) RemotePort(ctx context.Context) (*int, error)

func (*SocketBase) SetNoDelay

func (s *SocketBase) SetNoDelay(ctx context.Context) error

func (*SocketBase) SetTimeout

func (s *SocketBase) SetTimeout(ctx context.Context) error

func (*SocketBase) V8FuncAddress

func (s *SocketBase) V8FuncAddress(in isolates.FunctionArgs) (*isolates.Value, error)

func (*SocketBase) V8FuncSetNoDelay

func (s *SocketBase) V8FuncSetNoDelay(in isolates.FunctionArgs) (*isolates.Value, error)

func (*SocketBase) V8FuncSetTimeout

func (s *SocketBase) V8FuncSetTimeout(in isolates.FunctionArgs) (*isolates.Value, error)

func (*SocketBase) V8GetLocalAddress

func (s *SocketBase) V8GetLocalAddress(in isolates.GetterArgs) (*isolates.Value, error)

func (*SocketBase) V8GetLocalFamily

func (s *SocketBase) V8GetLocalFamily(in isolates.GetterArgs) (*isolates.Value, error)

func (*SocketBase) V8GetLocalPort

func (s *SocketBase) V8GetLocalPort(in isolates.GetterArgs) (*isolates.Value, error)

func (*SocketBase) V8GetRemoteAddress

func (s *SocketBase) V8GetRemoteAddress(in isolates.GetterArgs) (*isolates.Value, error)

func (*SocketBase) V8GetRemoteFamily

func (s *SocketBase) V8GetRemoteFamily(in isolates.GetterArgs) (*isolates.Value, error)

func (*SocketBase) V8GetRemotePort

func (s *SocketBase) V8GetRemotePort(in isolates.GetterArgs) (*isolates.Value, error)

Jump to

Keyboard shortcuts

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