snell

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 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 added in v1.2.0

func HalfClose(conn net.Conn) error

HalfClose works only on version2

func NewAES128GCM added in v1.2.0

func NewAES128GCM(psk []byte) shadowaead.Cipher

func NewChacha20Poly1305 added in v1.2.0

func NewChacha20Poly1305(psk []byte) shadowaead.Cipher

func WriteHeader

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

Types

type Pool added in v1.2.0

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

func NewPool added in v1.2.0

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

func (*Pool) Get added in v1.2.0

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

func (*Pool) GetContext added in v1.2.0

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

func (*Pool) Put added in v1.2.0

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

type PoolConn added in v1.2.0

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

func (*PoolConn) Close added in v1.2.0

func (pc *PoolConn) Close() error

func (*PoolConn) Read added in v1.2.0

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

func (*PoolConn) Write added in v1.2.0

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