snell

package
v0.0.0-...-317432a Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version1            = 1
	Version2            = 2
	DefaultSnellVersion = Version1
)
View Source
const (
	CommandPing      byte = 0
	CommandConnect   byte = 1
	CommandConnectV2 byte = 5

	CommandTunnel byte = 0
	CommandPong   byte = 1
	CommandError  byte = 2

	Version byte = 1
)

Variables

This section is empty.

Functions

func HalfClose

func HalfClose(conn net.Conn) error

HalfClose works only on version2

func NewAES128GCM

func NewAES128GCM(psk []byte) shadowaead.Cipher

func NewChacha20Poly1305

func NewChacha20Poly1305(psk []byte) shadowaead.Cipher

func WriteHeader

func WriteHeader(conn net.Conn, host string, port uint, version int) error

Types

type Pool

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

func NewPool

func NewPool(factory func(context.Context) (*Snell, error)) *Pool

func (*Pool) Get

func (p *Pool) Get() (net.Conn, error)

func (*Pool) GetContext

func (p *Pool) GetContext(ctx context.Context) (net.Conn, error)

func (*Pool) Put

func (p *Pool) Put(conn net.Conn)

type PoolConn

type PoolConn struct {
	*Snell
	// contains filtered or unexported fields
}

func (*PoolConn) Close

func (pc *PoolConn) Close() error

func (*PoolConn) Read

func (pc *PoolConn) Read(b []byte) (int, error)

func (*PoolConn) Write

func (pc *PoolConn) Write(b []byte) (int, error)

type Snell

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

func StreamConn

func StreamConn(conn net.Conn, psk []byte, version int) *Snell

func (*Snell) Read

func (s *Snell) Read(b []byte) (int, error)

Jump to

Keyboard shortcuts

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