net

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const NotFound = `` /* 612-byte string literal not displayed */

Variables

This section is empty.

Functions

func NotFoundResponse

func NotFoundResponse() *http.Response

Types

type BufferedConn

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

func NewBufferedConn

func NewBufferedConn(c net.Conn) *BufferedConn

func (*BufferedConn) Buffered

func (c *BufferedConn) Buffered() int

func (*BufferedConn) Peek

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

Peek returns the next n bytes without advancing the reader.

func (*BufferedConn) Read

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

func (*BufferedConn) ReadByte

func (c *BufferedConn) ReadByte() (byte, error)

func (*BufferedConn) Reader

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

Reader returns the internal bufio.Reader.

func (*BufferedConn) UnreadByte

func (c *BufferedConn) UnreadByte() error

type IConnHandler

type IConnHandler interface {
	Handler(wg *sync.WaitGroup, conn net.Conn)
}

type Listener

type Listener struct {
	Addr string
	Port int64
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, port int64) *Listener

func (*Listener) Address

func (l *Listener) Address() string

func (*Listener) ListenAndServe

func (l *Listener) ListenAndServe(handler IConnHandler) (err error)

func (*Listener) RawAddress

func (l *Listener) RawAddress() string

func (*Listener) Shutdown

func (l *Listener) Shutdown(ctx context.Context) error

func (*Listener) State

func (l *Listener) State() bool

type Relay

type Relay struct {
	Src      net.Conn
	Dest     net.Conn
	Metadata *constant.Metadata
	Token    []byte
}

func (*Relay) Start

func (r *Relay) Start(s int)

type SecureTCPConn

type SecureTCPConn struct {
	io.ReadWriteCloser
}

SecureTCPConn 加密传输的 TCP Socket

func (*SecureTCPConn) EncodeCopy

func (secureSocket *SecureTCPConn) EncodeCopy(token []byte, dst io.ReadWriteCloser) error

func (*SecureTCPConn) EncodeWrite

func (secureSocket *SecureTCPConn) EncodeWrite(token, bs []byte) (int, error)

EncodeWrite 把放在bs里的数据加密后立即全部写入输出流

Jump to

Keyboard shortcuts

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