Documentation ¶
Index ¶
- Constants
- Variables
- func AuthEAuthID(blk cipher.Block, eAuthID []byte, doubleCuckoo *ReplayFilter, ...) error
- func ContainOption(options byte, option byte) bool
- func DefaultIDHash(key []byte) hash.Hash
- func EncryptReqHeaderFromPool(instruction []byte, cmdKey []byte) ([]byte, error)
- func ExtractPacketAddr(src []byte) (protocol.MetadataType, netip.AddrPort, error)
- func GenerateChacha20Poly1305KeyFromPool(b []byte) []byte
- func KDF(key []byte, path ...[]byte) []byte
- func MetadataTypeToByte(typ protocol.MetadataType) byte
- func NetworkToByte(network string) byte
- func NewAesGcm(key []byte) (cipher.AEAD, error)
- func NewC20P1305(key []byte) (cipher.AEAD, error)
- func NewDialer(nextDialer netproxy.Dialer, header protocol.Header) (netproxy.Dialer, error)
- func NewDialerFactory(proto protocol.Protocol) ...
- func PacketAddrLength(typ protocol.MetadataType) int
- func ParseMetadataType(t byte) protocol.MetadataType
- func ParseNetwork(n byte) string
- func ParsePacketAddrType(t byte) protocol.MetadataType
- func PutEAuthID(dst []byte, cmdKey []byte) []byte
- func PutPacketAddr(src []byte, addr *net.UDPAddr) error
- func ReqInstructionDataFromPool(metadata Metadata) []byte
- func RespHeaderFromPool(V byte) []byte
- func UDPAddrToPacketAddrLength(addr *net.UDPAddr) int
- type BytesGenerator
- type ChunkSizeDecoder
- type ChunkSizeEncoder
- type Cipher
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) EncryptRespHeaderFromPool(header []byte) (b []byte, err error)
- func (c *Conn) InitContext(instructionData []byte) error
- func (c *Conn) Metadata() Metadata
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) ReadFrom(p []byte) (n int, addr netip.AddrPort, err error)
- func (c *Conn) Write(b []byte) (n int, err error)
- func (c *Conn) WriteReqHeader() (err error)
- func (c *Conn) WriteTo(p []byte, addr string) (n int, err error)
- type Dialer
- type ID
- type IDHash
- type Metadata
- type PaddingLengthGenerator
- type PlainChunkSizeParser
- type PlainPaddingGenerator
- type ReplayFilter
- type ShakeSizeParser
Constants ¶
View Source
const ( KDFSaltConstAuthIDEncryptionKey = "AES Auth ID Encryption" KDFSaltConstAEADRespHeaderLenKey = "AEAD Resp Header Len Key" KDFSaltConstAEADRespHeaderLenIV = "AEAD Resp Header Len IV" KDFSaltConstAEADRespHeaderPayloadKey = "AEAD Resp Header Key" KDFSaltConstAEADRespHeaderPayloadIV = "AEAD Resp Header IV" KDFSaltConstVMessAEADKDF = "VMess AEAD KDF" KDFSaltConstVMessHeaderPayloadAEADKey = "VMess Header AEAD Key" KDFSaltConstVMessHeaderPayloadAEADIV = "VMess Header AEAD Nonce" KDFSaltConstVMessHeaderPayloadLengthAEADKey = "VMess Header AEAD Key_Length" KDFSaltConstVMessHeaderPayloadLengthAEADIV = "VMess Header AEAD Nonce_Length" )
View Source
const ( OptionChunkStream = 1 OptionChunkLengthMasking = 4 OptionGlobalPadding = 8 )
View Source
const ( MaxChunkSize = 1 << 14 MaxUDPSize = 1 << 11 )
View Source
const (
IDBytesLen = 16
)
View Source
const SeqPacketMagicAddress = "sp.packet-addr.v2fly.arpa"
Variables ¶
View Source
var (
ErrInvalidMetadata = fmt.Errorf("invalid metadata")
)
View Source
var ( NewCipherMapper = map[Cipher]func(key []byte) (cipher.AEAD, error){ CipherC20P1305: NewC20P1305, CipherAES128GCM: NewAesGcm, } )
Functions ¶
func AuthEAuthID ¶
func ContainOption ¶
func DefaultIDHash ¶
func ExtractPacketAddr ¶
func GenerateChacha20Poly1305KeyFromPool ¶
GenerateChacha20Poly1305Key generates a 32-byte key from a given 16-byte array.
func MetadataTypeToByte ¶
func MetadataTypeToByte(typ protocol.MetadataType) byte
func NetworkToByte ¶
func NewDialerFactory ¶
func PacketAddrLength ¶
func PacketAddrLength(typ protocol.MetadataType) int
func ParseMetadataType ¶
func ParseMetadataType(t byte) protocol.MetadataType
func ParseNetwork ¶
func ParsePacketAddrType ¶
func ParsePacketAddrType(t byte) protocol.MetadataType
func PutEAuthID ¶
func RespHeaderFromPool ¶
Types ¶
type BytesGenerator ¶
type BytesGenerator func() []byte
func GenerateChunkNonce ¶
func GenerateChunkNonce(nonce []byte, size uint32) BytesGenerator
type ChunkSizeDecoder ¶
ChunkSizeDecoder is a utility class to decode size value from bytes.
type ChunkSizeEncoder ¶
ChunkSizeEncoder is a utility class to encode size value into bytes.
type Conn ¶
type Conn struct { netproxy.Conn NewAEAD func(key []byte) (cipher.AEAD, error) // contains filtered or unexported fields }
func (*Conn) EncryptRespHeaderFromPool ¶
func (*Conn) InitContext ¶
func (*Conn) WriteReqHeader ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
The ID of en entity, in the form of a UUID.
func NewAlterIDs ¶
type Metadata ¶
func NewServerMetadata ¶
func (*Metadata) CompleteFromInstructionData ¶
func (*Metadata) IsPacketAddr ¶
type PaddingLengthGenerator ¶
type PlainChunkSizeParser ¶
type PlainChunkSizeParser struct{}
func (PlainChunkSizeParser) Encode ¶
func (PlainChunkSizeParser) Encode(size uint16, b []byte) []byte
func (PlainChunkSizeParser) SizeBytes ¶
func (PlainChunkSizeParser) SizeBytes() int32
type PlainPaddingGenerator ¶
type PlainPaddingGenerator struct {
PaddingLengthGenerator
}
func (PlainPaddingGenerator) MaxPaddingLen ¶
func (PlainPaddingGenerator) MaxPaddingLen() uint16
func (PlainPaddingGenerator) NextPaddingLen ¶
func (PlainPaddingGenerator) NextPaddingLen() uint16
type ReplayFilter ¶
type ReplayFilter struct {
// contains filtered or unexported fields
}
ReplayFilter check for replay attacks.
func NewReplayFilter ¶
func NewReplayFilter(interval int64) *ReplayFilter
NewReplayFilter create a new filter with specifying the expiration time interval in seconds.
func (*ReplayFilter) Check ¶
func (filter *ReplayFilter) Check(sum []byte) bool
Check determine if there are duplicate records.
func (*ReplayFilter) Interval ¶
func (filter *ReplayFilter) Interval() int64
Interval in second for expiration time for duplicate records.
type ShakeSizeParser ¶
type ShakeSizeParser struct {
// contains filtered or unexported fields
}
func NewShakeSizeParser ¶
func NewShakeSizeParser(nonce []byte) *ShakeSizeParser
func (*ShakeSizeParser) MaxPaddingLen ¶
func (s *ShakeSizeParser) MaxPaddingLen() uint16
func (*ShakeSizeParser) NextPaddingLen ¶
func (s *ShakeSizeParser) NextPaddingLen() uint16
func (*ShakeSizeParser) SizeBytes ¶
func (*ShakeSizeParser) SizeBytes() int32
Click to show internal directories.
Click to hide internal directories.