Documentation ¶
Index ¶
- Constants
- Variables
- func Blake3KeyedHash(reader io.Reader) io.Reader
- func Key(key []byte, keyLength int) []byte
- func New(method string, pskList [][]byte, timeFunc func() time.Time) (shadowsocks.Method, error)
- func NewService(method string, psk []byte, udpTimeout int64, handler shadowsocks.Handler, ...) (shadowsocks.Service, error)
- func NewServiceWithPassword(method string, password string, udpTimeout int64, handler shadowsocks.Handler, ...) (shadowsocks.Service, error)
- func NewWithPassword(method string, password string, timeFunc func() time.Time) (shadowsocks.Method, error)
- func SessionKey(psk []byte, salt []byte, keyLength int) []byte
- type Method
- type MultiService
- func (s *MultiService[U]) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error
- func (s *MultiService[U]) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, ...) error
- func (s *MultiService[U]) UpdateUsers(userList []U, keyList [][]byte) error
- func (s *MultiService[U]) UpdateUsersWithPasswords(userList []U, passwordList []string) error
- func (s *MultiService[U]) WriteIsThreadUnsafe()
- type RelayService
- func (s *RelayService[U]) Name() string
- func (s *RelayService[U]) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error
- func (s *RelayService[U]) NewError(ctx context.Context, err error)
- func (s *RelayService[U]) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, ...) error
- func (s *RelayService[U]) Password() string
- func (s *RelayService[U]) UpdateUsers(userList []U, keyList [][]byte, destinationList []M.Socksaddr) error
- func (s *RelayService[U]) UpdateUsersWithPasswords(userList []U, passwordList []string, destinationList []M.Socksaddr) error
- func (s *RelayService[U]) WriteIsThreadUnsafe()
- type Service
- func (s *Service) Name() string
- func (s *Service) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error
- func (s *Service) NewError(ctx context.Context, err error)
- func (s *Service) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, ...) error
- func (s *Service) Password() string
- func (s *Service) WriteIsThreadUnsafe()
- type SlidingWindow
Constants ¶
View Source
const ( HeaderTypeClient = 0 HeaderTypeServer = 1 MaxPaddingLength = 900 PacketNonceSize = 24 MaxPacketSize = 65535 RequestHeaderFixedChunkLength = 1 + 8 + 2 PacketMinimalHeaderSize = 30 )
Variables ¶
View Source
var ( ErrMissingPSK = E.New("missing psk") ErrBadHeaderType = E.New("bad header type") ErrBadTimestamp = E.New("bad timestamp") ErrBadRequestSalt = E.New("bad request salt") ErrSaltNotUnique = E.New("salt not unique") ErrBadClientSessionId = E.New("bad client session id") ErrPacketIdNotUnique = E.New("packet id not unique") ErrTooManyServerSessions = E.New("server session changed more than once during the last minute") ErrPacketTooShort = E.New("packet too short") )
View Source
var ( ErrNoPadding = E.New("bad request: missing payload or padding") ErrBadPadding = E.New("bad request: damaged padding") )
View Source
var List = []string{
"2022-blake3-aes-128-gcm",
"2022-blake3-aes-256-gcm",
"2022-blake3-chacha20-poly1305",
}
Functions ¶
func NewService ¶
func NewService(method string, psk []byte, udpTimeout int64, handler shadowsocks.Handler, timeFunc func() time.Time) (shadowsocks.Service, error)
func NewServiceWithPassword ¶
func NewServiceWithPassword(method string, password string, udpTimeout int64, handler shadowsocks.Handler, timeFunc func() time.Time) (shadowsocks.Service, error)
func NewWithPassword ¶
Types ¶
type Method ¶
type Method struct {
// contains filtered or unexported fields
}
func (*Method) DialEarlyConn ¶
func (*Method) DialPacketConn ¶
func (m *Method) DialPacketConn(conn net.Conn) N.NetPacketConn
type MultiService ¶
type MultiService[U comparable] struct { *Service // contains filtered or unexported fields }
func NewMultiService ¶
func NewMultiService[U comparable](method string, iPSK []byte, udpTimeout int64, handler shadowsocks.Handler, timeFunc func() time.Time) (*MultiService[U], error)
func NewMultiServiceWithPassword ¶
func NewMultiServiceWithPassword[U comparable](method string, password string, udpTimeout int64, handler shadowsocks.Handler, timeFunc func() time.Time) (*MultiService[U], error)
func (*MultiService[U]) NewConnection ¶
func (*MultiService[U]) NewPacket ¶
func (s *MultiService[U]) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata M.Metadata) error
func (*MultiService[U]) UpdateUsers ¶
func (s *MultiService[U]) UpdateUsers(userList []U, keyList [][]byte) error
func (*MultiService[U]) UpdateUsersWithPasswords ¶
func (s *MultiService[U]) UpdateUsersWithPasswords(userList []U, passwordList []string) error
func (*MultiService[U]) WriteIsThreadUnsafe ¶
func (s *MultiService[U]) WriteIsThreadUnsafe()
type RelayService ¶
type RelayService[U comparable] struct { // contains filtered or unexported fields }
func NewRelayService ¶
func NewRelayService[U comparable](method string, psk []byte, udpTimeout int64, handler shadowsocks.Handler) (*RelayService[U], error)
func NewRelayServiceWithPassword ¶
func NewRelayServiceWithPassword[U comparable](method string, password string, udpTimeout int64, handler shadowsocks.Handler) (*RelayService[U], error)
func (*RelayService[U]) Name ¶
func (s *RelayService[U]) Name() string
func (*RelayService[U]) NewConnection ¶
func (*RelayService[U]) NewError ¶
func (s *RelayService[U]) NewError(ctx context.Context, err error)
func (*RelayService[U]) NewPacket ¶
func (s *RelayService[U]) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata M.Metadata) error
func (*RelayService[U]) Password ¶
func (s *RelayService[U]) Password() string
func (*RelayService[U]) UpdateUsers ¶
func (s *RelayService[U]) UpdateUsers(userList []U, keyList [][]byte, destinationList []M.Socksaddr) error
func (*RelayService[U]) UpdateUsersWithPasswords ¶
func (s *RelayService[U]) UpdateUsersWithPasswords(userList []U, passwordList []string, destinationList []M.Socksaddr) error
func (*RelayService[U]) WriteIsThreadUnsafe ¶
func (s *RelayService[U]) WriteIsThreadUnsafe()
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) NewConnection ¶
func (*Service) WriteIsThreadUnsafe ¶
func (s *Service) WriteIsThreadUnsafe()
type SlidingWindow ¶
type SlidingWindow struct {
// contains filtered or unexported fields
}
SlidingWindow maintains a sliding window of uint64 counters.
func (*SlidingWindow) Add ¶
func (f *SlidingWindow) Add(counter uint64)
Add adds counter to the sliding window without checking if the counter is valid. Call Check beforehand to make sure the counter is valid.
func (*SlidingWindow) Check ¶
func (f *SlidingWindow) Check(counter uint64) bool
Check checks whether counter can be accepted by the sliding window filter.
func (*SlidingWindow) Reset ¶
func (f *SlidingWindow) Reset()
Reset resets the filter to its initial state.
Click to show internal directories.
Click to hide internal directories.