shadowsocks

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: AGPL-3.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// BasicLen is the basic auth length of [salt][encrypted payload length][length tag][encrypted payload][payload tag]
	BasicLen      = 32 + 2 + 16
	TCPBufferSize = 32 * 1024
)

Variables

This section is empty.

Functions

func LocalizePassages

func LocalizePassages(passages []server.Passage) (psgs []Passage, manager *Passage)

func New

func New(valueCtx context.Context, dialer proxy.Dialer) (server.Server, error)

func NewJohn added in v1.1.3

func NewJohn(valueCtx context.Context, dialer proxy.Dialer, sweetLisa config.Lisa, arg server.Argument) (server.Server, error)

Types

type Passage

type Passage struct {
	server.Passage
	// contains filtered or unexported fields
}

type Server

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

func (*Server) AddPassages

func (s *Server) AddPassages(passages []server.Passage) (err error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) ContentionCheck added in v0.1.9

func (s *Server) ContentionCheck(thisIP net.IP, passage *Passage) (err error)

func (*Server) GetOrBuildUDPConn added in v1.1.6

func (s *Server) GetOrBuildUDPConn(lAddr net.Addr, data []byte) (rc net.PacketConn, passage *Passage, plainText []byte, target string, err error)

GetOrBuildUDPConn get a UDP conn from the mapping. plainText is from pool and starts with metadata. Please MUST put it back.

func (*Server) GetUserContextOrInsert

func (s *Server) GetUserContextOrInsert(userIP string) *UserContext

func (*Server) Listen

func (s *Server) Listen(addr string) (err error)

func (*Server) ListenTCP

func (s *Server) ListenTCP(addr string) (err error)

func (*Server) ListenUDP

func (s *Server) ListenUDP(addr string) (err error)

func (*Server) Passages

func (s *Server) Passages() (passages []server.Passage)

func (*Server) RemovePassages

func (s *Server) RemovePassages(passages []server.Passage, alsoManager bool) (err error)

func (*Server) SyncPassages

func (s *Server) SyncPassages(passages []server.Passage) (err error)

type UDPConn

type UDPConn struct {
	Establishing chan struct{}
	Timeout      time.Duration
	net.PacketConn
}

func NewUDPConn

func NewUDPConn(conn net.PacketConn) *UDPConn

type UDPConnMapping

type UDPConnMapping struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewUDPConnMapping

func NewUDPConnMapping() *UDPConnMapping

func (*UDPConnMapping) Get

func (m *UDPConnMapping) Get(key string) (conn *UDPConn, ok bool)

func (*UDPConnMapping) Insert

func (m *UDPConnMapping) Insert(key string, val net.PacketConn) *UDPConn

pass val=nil for stating it is establishing

func (*UDPConnMapping) Remove

func (m *UDPConnMapping) Remove(key string)

type UserContext

type UserContext lrulist.LruList

UserContext is the context of a user which indicates the preferred servers

func NewUserContext

func NewUserContext(passages []Passage) *UserContext

func (*UserContext) Auth

func (ctx *UserContext) Auth(probe func(*Passage) ([]byte, bool)) (hit *Passage, content []byte)

func (*UserContext) Close

func (ctx *UserContext) Close() error

func (*UserContext) Infra

func (ctx *UserContext) Infra() *lrulist.LruList

type UserContextPool

type UserContextPool lru.LRU

UserContextPool is a pool which saves the UserContext and eliminates unused UserContext over time

func (*UserContextPool) Infra

func (pool *UserContextPool) Infra() *lru.LRU

Jump to

Keyboard shortcuts

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