Documentation
¶
Index ¶
- Constants
- Variables
- type AESGCMCrypto
- type Codec
- type CodecEntity
- func (c *CodecEntity) DecodeMessage(data []byte) (*message.Message, error)
- func (c *CodecEntity) DecodeMessageRaw(data []byte) (*message.Message, error)
- func (c *CodecEntity) DecodeMessageWithDetection(data []byte) (*message.Message, error)
- func (c *CodecEntity) DecodePacket(data []byte) ([]*packet.Packet, error)
- func (c *CodecEntity) EncodeMessage(m *message.Message) ([]byte, error)
- func (c *CodecEntity) EncodePacket(packets []*packet.Packet) ([]byte, error)
- func (c *CodecEntity) String() string
- type Crypto
- type CryptoEntity
- type CryptoType
- type PlainCrypto
- type XORCrypto
Constants ¶
View Source
const ( HeadLength = 4 MaxPacketSize = 64 * 1024 * 1024 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AESGCMCrypto ¶ added in v1.2.0
type AESGCMCrypto struct{}
func (*AESGCMCrypto) Decrypt ¶ added in v1.2.0
func (*AESGCMCrypto) Decrypt(ciphertext, key []byte) ([]byte, error)
func (*AESGCMCrypto) Encrypt ¶ added in v1.2.0
func (aesgcm *AESGCMCrypto) Encrypt(plaintext, key []byte) ([]byte, error)
func (*AESGCMCrypto) EncryptWithNonce ¶ added in v1.2.0
func (*AESGCMCrypto) EncryptWithNonce(plaintext, key []byte, nonce []byte) ([]byte, error)
func (*AESGCMCrypto) String ¶ added in v1.2.0
func (*AESGCMCrypto) String() string
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
func (*Codec) Entity ¶
func (c *Codec) Entity(dictionary message.Dictionary) codec.CodecEntity
type CodecEntity ¶
type CodecEntity struct {
// contains filtered or unexported fields
}
func NewCodecEntity ¶
func NewCodecEntity(dictionary message.Dictionary, cryptoKey []byte) *CodecEntity
func (*CodecEntity) DecodeMessage ¶
func (c *CodecEntity) DecodeMessage(data []byte) (*message.Message, error)
func (*CodecEntity) DecodeMessageRaw ¶ added in v1.2.0
func (c *CodecEntity) DecodeMessageRaw(data []byte) (*message.Message, error)
func (*CodecEntity) DecodeMessageWithDetection ¶ added in v1.2.0
func (c *CodecEntity) DecodeMessageWithDetection(data []byte) (*message.Message, error)
func (*CodecEntity) DecodePacket ¶
func (c *CodecEntity) DecodePacket(data []byte) ([]*packet.Packet, error)
func (*CodecEntity) EncodeMessage ¶
func (c *CodecEntity) EncodeMessage(m *message.Message) ([]byte, error)
func (*CodecEntity) EncodePacket ¶
func (c *CodecEntity) EncodePacket(packets []*packet.Packet) ([]byte, error)
func (*CodecEntity) String ¶ added in v1.1.49
func (c *CodecEntity) String() string
type CryptoEntity ¶ added in v1.2.0
func NewCryptoEntity ¶ added in v1.2.0
func NewCryptoEntity(key []byte, crypto Crypto) *CryptoEntity
type CryptoType ¶ added in v1.2.0
type CryptoType uint32
const ( AESGCM CryptoType = iota XOR Plain Unknown )
func (CryptoType) Crypto ¶ added in v1.2.0
func (c CryptoType) Crypto() Crypto
func (CryptoType) Decrypt ¶ added in v1.2.0
func (c CryptoType) Decrypt(ciphertext, key []byte) ([]byte, error)
func (CryptoType) Encrypt ¶ added in v1.2.0
func (c CryptoType) Encrypt(plaintext, key []byte) ([]byte, error)
func (CryptoType) String ¶ added in v1.2.0
func (c CryptoType) String() string
type PlainCrypto ¶ added in v1.2.0
type PlainCrypto struct{}
func (*PlainCrypto) Decrypt ¶ added in v1.2.0
func (*PlainCrypto) Decrypt(ciphertext, key []byte) ([]byte, error)
func (*PlainCrypto) Encrypt ¶ added in v1.2.0
func (*PlainCrypto) Encrypt(plaintext, key []byte) ([]byte, error)
func (*PlainCrypto) String ¶ added in v1.2.0
func (*PlainCrypto) String() string
Click to show internal directories.
Click to hide internal directories.