gonet

package
v0.0.0-...-55fcc16 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Overview

Package gonet provides a Go net package compatible wrapper for a tcpip stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

A Conn is a wrapper around a tcpip.Endpoint that implements the net.Conn interface.

func DialContextTCP

func DialContextTCP(ctx context.Context, s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*Conn, error)

DialContextTCP creates a new TCP Conn connected to the specified address with the option of adding cancellation and timeouts.

func DialTCP

func DialTCP(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*Conn, error)

DialTCP creates a new TCP Conn connected to the specified address.

func NewConn

func NewConn(wq *waiter.Queue, ep tcpip.Endpoint) *Conn

NewConn creates a new Conn.

func (*Conn) Close

func (c *Conn) Close() error

Close implements net.Conn.Close.

func (*Conn) CloseRead

func (c *Conn) CloseRead() error

CloseRead shuts down the reading side of the TCP connection. Most callers should just use Close.

A TCP Half-Close is performed the same as CloseRead for *net.TCPConn.

func (*Conn) CloseWrite

func (c *Conn) CloseWrite() error

CloseWrite shuts down the writing side of the TCP connection. Most callers should just use Close.

A TCP Half-Close is performed the same as CloseWrite for *net.TCPConn.

func (*Conn) LocalAddr

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

LocalAddr implements net.Conn.LocalAddr.

func (*Conn) Read

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

Read implements net.Conn.Read.

func (*Conn) RemoteAddr

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

RemoteAddr implements net.Conn.RemoteAddr.

func (*Conn) SetDeadline

func (d *Conn) SetDeadline(t time.Time) error

SetDeadline implements net.Conn.SetDeadline and net.PacketConn.SetDeadline.

func (*Conn) SetReadDeadline

func (d *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline implements net.Conn.SetReadDeadline and net.PacketConn.SetReadDeadline.

func (*Conn) SetWriteDeadline

func (d *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements net.Conn.SetWriteDeadline and net.PacketConn.SetWriteDeadline.

func (*Conn) Write

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

Write implements net.Conn.Write.

type Listener

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

A Listener is a wrapper around a tcpip endpoint that implements net.Listener.

func NewListener

func NewListener(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*Listener, error)

NewListener creates a new Listener.

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Accept implements net.Conn.Accept.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr implements net.Listener.Addr.

func (*Listener) Close

func (l *Listener) Close() error

Close implements net.Listener.Close.

func (*Listener) Shutdown

func (l *Listener) Shutdown()

Shutdown stops the HTTP server.

type PacketConn

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

A PacketConn is a wrapper around a tcpip endpoint that implements net.PacketConn.

func DialUDP

func DialUDP(s *stack.Stack, laddr, raddr *tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*PacketConn, error)

DialUDP creates a new PacketConn.

If laddr is nil, a local address is automatically chosen.

If raddr is nil, the PacketConn is left unconnected.

func (*PacketConn) Close

func (c *PacketConn) Close() error

Close implements net.PacketConn.Close.

func (*PacketConn) LocalAddr

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

LocalAddr implements net.PacketConn.LocalAddr.

func (*PacketConn) Read

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

Read implements net.Conn.Read

func (*PacketConn) ReadFrom

func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error)

ReadFrom implements net.PacketConn.ReadFrom.

func (*PacketConn) RemoteAddr

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

RemoteAddr implements net.Conn.RemoteAddr.

func (*PacketConn) SetDeadline

func (d *PacketConn) SetDeadline(t time.Time) error

SetDeadline implements net.Conn.SetDeadline and net.PacketConn.SetDeadline.

func (*PacketConn) SetReadDeadline

func (d *PacketConn) SetReadDeadline(t time.Time) error

SetReadDeadline implements net.Conn.SetReadDeadline and net.PacketConn.SetReadDeadline.

func (*PacketConn) SetWriteDeadline

func (d *PacketConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements net.Conn.SetWriteDeadline and net.PacketConn.SetWriteDeadline.

func (*PacketConn) Write

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

func (*PacketConn) WriteTo

func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error)

WriteTo implements net.PacketConn.WriteTo.

Jump to

Keyboard shortcuts

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