tcp

package
v0.0.3-pre8 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SOL_IP is not defined on darwin
	SOL_IP = 0x0

	// SOL_IPV6 is not defined on darwin
	SOL_IPV6 = 0x29
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is TCP connection

func Dial

func Dial(laddr, raddr *net.TCPAddr, ttl uint8, md5Secret string, noRoute bool) (*Conn, error)

Dial established a new TCP connection

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection

func (*Conn) LocalAddr

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

LocalAddr gets the local address

func (*Conn) Read

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

Read reads from a TCP connection

func (*Conn) RemoteAddr

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

RemoteAddr gets the remote address

func (*Conn) SetDeadline

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

SetDeadline is here to fulfill net.Conn interface

func (*Conn) SetDontRoute

func (c *Conn) SetDontRoute() error

SetDontRoute sets the SO_DONTROUTE option

func (*Conn) SetNoDelay

func (c *Conn) SetNoDelay() error

SetNoDelay sets the TCP_NODELAY option

func (*Conn) SetReadDeadline

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

SetReadDeadline is here to fulfill net.Conn interface

func (*Conn) SetTTL

func (c *Conn) SetTTL(ttl uint8) error

SetTTL sets the TTL on a TCP connection

func (*Conn) SetWriteDeadline

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

SetWriteDeadline is here to fulfill net.Conn interface

func (*Conn) Write

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

Write writes to a TCP connection

type Listener

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

Listener listens for TCP clients

func Listen

func Listen(laddr *net.TCPAddr, ttl uint8) (*Listener, error)

Listen starts a TCPListener

func (*Listener) AcceptTCP

func (l *Listener) AcceptTCP() (*Conn, error)

AcceptTCP accepts a new TCP connection

func (*Listener) SetTCPMD5

func (l *Listener) SetTCPMD5(peerAddr net.IP, secret string) error

SetTCPMD5 sets a TCP md5 secret for addr

Jump to

Keyboard shortcuts

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