Documentation ¶
Index ¶
- Constants
- Variables
- func BytesSizeForMetadata(firstTwoByte []byte) (int, error)
- func CalcPaddingLen(masterKey []byte, bodyWithoutAddr []byte, req bool) (length int)
- func DecryptUDP(writeTo []byte, key *Key, shadowBytes []byte, reusedInfo []byte) (n int, err error)
- func DecryptUDPFromPool(key *Key, shadowBytes []byte, reusedInfo []byte) (buf pool.PB, err error)
- func EncryptUDPFromPool(key *Key, b []byte, salt []byte, reusedInfo []byte) (shadowBytes pool.PB, err error)
- func EncryptedPayloadLen(plainTextLen int, tagLen int) int
- func MetadataTypeToByte(typ protocol.MetadataType) byte
- func NewDialer(nextDialer netproxy.Dialer, header protocol.Header) (netproxy.Dialer, error)
- func ParseMetadataType(t byte) protocol.MetadataType
- type Dialer
- type DummySaltGenerator
- type IodizedSaltGenerator
- type Key
- type Metadata
- type RandomSaltGenerator
- type SaltGenerator
- type SaltGeneratorType
- type TCPConn
- type UdpConn
Constants ¶
View Source
const DefaultBucketSize = 300
View Source
const (
TCPChunkMaxLen = (1 << (16 - 2)) - 1
)
Variables ¶
View Source
var ( DefaultSaltGeneratorType = RandomSaltGeneratorType DefaultIodizedSource = "https://github.com/explore" )
View Source
var (
ErrFailInitCipher = fmt.Errorf("fail to initiate cipher")
)
View Source
var (
ErrInvalidMetadata = fmt.Errorf("invalid metadata")
)
Functions ¶
func BytesSizeForMetadata ¶
func CalcPaddingLen ¶
func DecryptUDP ¶
DecryptUDP will decrypt the data in place
func DecryptUDPFromPool ¶
DecryptUDP will decrypt the data in place
func EncryptUDPFromPool ¶
func EncryptUDPFromPool(key *Key, b []byte, salt []byte, reusedInfo []byte) (shadowBytes pool.PB, err error)
EncryptUDPFromPool returns shadowBytes from pool. the shadowBytes MUST be put back.
func EncryptedPayloadLen ¶
func MetadataTypeToByte ¶
func MetadataTypeToByte(typ protocol.MetadataType) byte
func ParseMetadataType ¶
func ParseMetadataType(t byte) protocol.MetadataType
Types ¶
type DummySaltGenerator ¶
type DummySaltGenerator struct { Closed chan struct{} Success bool }
func NewDummySaltGenerator ¶
func NewDummySaltGenerator() *DummySaltGenerator
func (*DummySaltGenerator) Close ¶
func (g *DummySaltGenerator) Close() error
func (*DummySaltGenerator) Get ¶
func (g *DummySaltGenerator) Get() []byte
type IodizedSaltGenerator ¶
type IodizedSaltGenerator struct {
// contains filtered or unexported fields
}
func NewIodizedSaltGenerator ¶
func NewIodizedSaltGenerator(salt []byte, saltSize, bucketSize int, fromPool bool) (*IodizedSaltGenerator, error)
func (*IodizedSaltGenerator) Close ¶
func (g *IodizedSaltGenerator) Close() error
func (*IodizedSaltGenerator) Get ¶
func (g *IodizedSaltGenerator) Get() []byte
type Key ¶
type Key struct { CipherConf *ciphers.CipherConf MasterKey []byte }
type RandomSaltGenerator ¶
type RandomSaltGenerator struct {
// contains filtered or unexported fields
}
func NewRandomSaltGenerator ¶
func NewRandomSaltGenerator(saltSize int, fromPool bool) (*RandomSaltGenerator, error)
func (*RandomSaltGenerator) Close ¶
func (g *RandomSaltGenerator) Close() error
func (*RandomSaltGenerator) Get ¶
func (g *RandomSaltGenerator) Get() []byte
type SaltGenerator ¶
func GetSaltGenerator ¶
func GetSaltGenerator(masterKey []byte, saltLen int) (sg SaltGenerator, err error)
type SaltGeneratorType ¶
type SaltGeneratorType int
const ( IodizedSaltGeneratorType SaltGeneratorType = iota RandomSaltGeneratorType )
type TCPConn ¶
func NewTCPConn ¶
func NewTCPConn(conn netproxy.Conn, metadata protocol.Metadata, masterKey []byte, bloom *disk_bloom.FilterGroup) (crw *TCPConn, err error)
func (*TCPConn) ReadMetadata ¶
type UdpConn ¶
type UdpConn struct { netproxy.PacketConn // contains filtered or unexported fields }
func NewUdpConn ¶
func NewUdpConn(conn netproxy.PacketConn, proxyAddress string, metadata protocol.Metadata, masterKey []byte, bloom *disk_bloom.FilterGroup) (*UdpConn, error)
Click to show internal directories.
Click to hide internal directories.