snell

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version1            = 1
	Version2            = 2
	Version3            = 3
	DefaultSnellVersion = Version1
)
View Source
const (
	CommandPing       byte = 0
	CommandConnect    byte = 1
	CommandConnectV2  byte = 5
	CommandUDP        byte = 6
	CommondUDPForward byte = 1

	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 PacketConn

func PacketConn(conn net.Conn) net.PacketConn

func ReadPacket

func ReadPacket(r io.Reader, payload []byte) (net.Addr, int, error)

func WriteHeader

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

func WritePacket

func WritePacket(w io.Writer, socks5Addr, payload []byte) (int, error)

func WriteUDPHeader

func WriteUDPHeader(conn net.Conn, 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 *Snell)

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