Documentation
¶
Index ¶
- Constants
- Variables
- func PrepAESForSending(key []byte, receiversPubKey *rsa.PublicKey, keyPair crypto.RSAKeys) ([]byte, error)
- func PrepBytesForSending(msg []byte, messageType MessageType, sentFrom, colour string, AESKey []byte) ([]byte, error)
- func PrepHandshakeForSending(msg []byte, sentFrom, colour string) ([]byte, error)
- type AESProtocol
- type MessageType
- type MsgProtocol
Constants ¶
View Source
const ( MaxMessageSize = 1000 MaxPacketSize = 1400 HeaderSize = 6 AESEncryptHeaderSize = 2 RequestConnect MessageType = iota RequestDisconnect Message KeepAlive WhisperMessage ServerActiveUsers ErrorMessage SendAESKey )
Variables ¶
View Source
var HeaderPattern = [...]byte{0, 0, 27, 0, 5, 19, 93, 255, 255, 255}
Functions ¶
func PrepAESForSending ¶
func PrepBytesForSending ¶
Types ¶
type AESProtocol ¶
type AESProtocol struct {
MessageType MessageType
MsgSize uint16
SigSize uint16
DateTime time.Time
Data [crypto.EncodedKeySize]byte
Sig [crypto.EncodedKeySize]byte
}
func DecodeAESPacket ¶
func DecodeAESPacket(buffer *bytes.Buffer) AESProtocol
type MessageType ¶
type MessageType uint8
type MsgProtocol ¶
type MsgProtocol struct {
MessageType MessageType
MsgSize uint16
UsernameSize uint16
UserColourSize uint16
Username [32]byte
UserColour [32]byte
DateTime time.Time
Data [MaxMessageSize]byte
}
func DecodeMsgPacket ¶
func DecodeMsgPacket(buffer *bytes.Buffer) MsgProtocol
Click to show internal directories.
Click to hide internal directories.