protocol

package
v0.3.1-beta.5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtocolMap = map[string]func(ProtocolInfo) Protocol{
	"auth_aes128_sha1": NewAuthAES128SHA1,
	"auth_aes128_md5":  NewAuthAES128MD5,
	"auth_chain_a":     NewAuthChainA,
	"auth_chain_b":     NewAuthChainB,
	"origin":           NewOrigin,
	"auth_sha1_v4":     NewAuthSHA1v4,
	"verify_sha1":      NewVerifySHA1,
	"ota":              NewVerifySHA1,
}

Functions

func CalcAdler32

func CalcAdler32(input []byte) uint32

func CheckAdler32

func CheckAdler32(input []byte, l int) bool

Types

type AuthData

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

type Protocol

type Protocol interface {
	EncryptStream(dst *bytes.Buffer, data []byte) error
	DecryptStream(dst *bytes.Buffer, data []byte) (int, error)
	EncryptPacket(data []byte) ([]byte, error)
	DecryptPacket(data []byte) ([]byte, error)

	GetOverhead() int
}

func NewAuthAES128MD5

func NewAuthAES128MD5(info ProtocolInfo) Protocol

func NewAuthAES128SHA1

func NewAuthAES128SHA1(info ProtocolInfo) Protocol

func NewAuthChainA

func NewAuthChainA(info ProtocolInfo) Protocol

func NewAuthChainB

func NewAuthChainB(info ProtocolInfo) Protocol

func NewAuthSHA1v4

func NewAuthSHA1v4(info ProtocolInfo) Protocol

func NewErrorProtocol

func NewErrorProtocol(err error) Protocol

func NewOrigin

func NewOrigin(ProtocolInfo) Protocol

func NewVerifySHA1

func NewVerifySHA1(info ProtocolInfo) Protocol

type ProtocolInfo

type ProtocolInfo struct {
	ssr.Info

	Name     string
	HeadSize int
	TcpMss   int
	Param    string
	IV       []byte

	Auth *AuthData

	ObfsOverhead int
}

func (ProtocolInfo) Packet

func (s ProtocolInfo) Packet(c net.PacketConn) (net.PacketConn, error)

func (*ProtocolInfo) SetHeadLen

func (s *ProtocolInfo) SetHeadLen(data []byte, defaultValue int)

func (ProtocolInfo) Stream

func (s ProtocolInfo) Stream(c net.Conn, iv []byte) (net.Conn, error)

Jump to

Keyboard shortcuts

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