conn

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TCPBufSize is the size of tcp buffer
	TCPBufSize = 16 << 10

	// UDPBufSize is the size of udp buffer
	UDPBufSize = 64 << 10
)

Variables

This section is empty.

Functions

func OutboundIP

func OutboundIP() string

OutboundIP returns preferred outbound ip of this machine.

func Relay

func Relay(left, right net.Conn) (int64, int64, error)

Relay relays between left and right.

func RelayUDP added in v0.7.0

func RelayUDP(dst net.PacketConn, target net.Addr, src net.PacketConn, timeout time.Duration) error

RelayUDP copys from src to dst at target with read timeout.

Types

type Conn

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

Conn is a base conn struct

func NewConn

func NewConn(c net.Conn) *Conn

NewConn returns a new conn.

func (*Conn) Peek

func (c *Conn) Peek(n int) ([]byte, error)

Peek returns the next n bytes without advancing the reader.

func (*Conn) Read

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

func (*Conn) Reader added in v0.6.10

func (c *Conn) Reader() *bufio.Reader

Reader returns the internal bufio.Reader.

Jump to

Keyboard shortcuts

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