shadowsocks

package
v0.0.0-...-ca67efc Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: GPL-2.0, GPL-3.0, LGPL-3.0, + 1 more Imports: 18 Imported by: 0

README

Documentation

Index

Constants

View Source
const MaxPacketSize = 16384
View Source
const MaxUDPPacketSize = 16384 // Max 65536

Variables

View Source
var ErrShortPacket = errors.New("short packet")

Functions

func NewConn

func NewConn(conn net.Conn, ciph Cipher) net.Conn

func NewDuplexConn

func NewDuplexConn(conn net.Conn) *duplexConn

func NewPacketConn

func NewPacketConn(pc net.PacketConn, ciph Cipher) net.PacketConn

func Pack

func Pack(dst, pkt []byte, ciph Cipher) ([]byte, error)

func ParseUrl

func ParseUrl(s string) (server, cipher, password string, err error)

func Unpack

func Unpack(dst, pkt []byte, ciph Cipher) ([]byte, error)

Types

type Cipher

type Cipher interface {
	KeySize() int
	SaltSize() int
	NewAead([]byte) (cipher.AEAD, error)
}

func NewCipher

func NewCipher(method, password string) (Cipher, error)

type Conn

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

func (*Conn) CloseRead

func (c *Conn) CloseRead() error

func (*Conn) CloseWrite

func (c *Conn) CloseWrite() error

func (*Conn) Read

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

func (*Conn) ReadFrom

func (c *Conn) ReadFrom(r io.Reader) (int64, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

func (*Conn) WriteTo

func (c *Conn) WriteTo(w io.Writer) (int64, error)

type DuplexConn

type DuplexConn interface {
	net.Conn
	CloseRead() error
	CloseWrite() error
}

type Handler

type Handler struct {
	Cipher
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(url string, timeout time.Duration) (*Handler, error)

func (*Handler) Handle

func (h *Handler) Handle(conn net.Conn, tgt net.Addr) error

func (*Handler) HandlePacket

func (h *Handler) HandlePacket(conn utils.PacketConn) error

type PacketConn

type PacketConn struct {
	net.PacketConn
	Cipher
}

func (*PacketConn) ReadFrom

func (pc *PacketConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*PacketConn) WriteTo

func (pc *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error)

Jump to

Keyboard shortcuts

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