Documentation ¶
Index ¶
- Constants
- Variables
- type DHTID
- type DHTPeer
- type EncryptedPacket
- type GetNodes
- type GetNodesReply
- type Identity
- func (id *Identity) DecryptPacket(encrypted *EncryptedPacket) (*PlainPacket, error)
- func (id *Identity) Encrypt(plain []byte, publicKey *[gotox.PublicKeySize]byte) (*[gotox.NonceSize]byte, []byte, error)
- func (id *Identity) EncryptPacket(plain *PlainPacket, publicKey *[gotox.PublicKeySize]byte) (*EncryptedPacket, error)
- type LocalTransport
- type Payload
- type PingPong
- type PlainPacket
- type Transport
- type TransportMessage
- type UDPTransport
Constants ¶
View Source
const AF_INET byte = 2
http://lxr.free-electrons.com/source/include/linux/socket.h TODO: get these from the source
View Source
const AF_INET6 byte = 10
View Source
const TCP_INET byte = 130
View Source
const TCP_INET6 byte = 138
Variables ¶
View Source
var DhtServerList []DHTPeer
Functions ¶
This section is empty.
Types ¶
type DHTID ¶
type DHTID [gotox.PublicKeySize]byte
type DHTPeer ¶
type DHTPeer struct { PublicKey [gotox.PublicKeySize]byte Addr net.UDPAddr }
func (*DHTPeer) MarshalBinary ¶
func (*DHTPeer) UnmarshalBinary ¶
func (*DHTPeer) UnmarshalJSON ¶
type EncryptedPacket ¶
type EncryptedPacket struct { Kind uint8 Sender *[gotox.PublicKeySize]byte Nonce *[gotox.NonceSize]byte Payload []byte }
func (*EncryptedPacket) MarshalBinary ¶
func (p *EncryptedPacket) MarshalBinary() ([]byte, error)
func (*EncryptedPacket) UnmarshalBinary ¶
func (p *EncryptedPacket) UnmarshalBinary(data []byte) error
type GetNodes ¶
type GetNodes struct { RequestedNodeID *[gotox.PublicKeySize]byte RequestID uint64 }
func (*GetNodes) MarshalBinary ¶
func (*GetNodes) UnmarshalBinary ¶
type GetNodesReply ¶
func (*GetNodesReply) Kind ¶
func (sn *GetNodesReply) Kind() uint8
func (*GetNodesReply) MarshalBinary ¶
func (sn *GetNodesReply) MarshalBinary() ([]byte, error)
func (*GetNodesReply) UnmarshalBinary ¶
func (sn *GetNodesReply) UnmarshalBinary(data []byte) error
type Identity ¶
type Identity struct { SymmetricKey [gotox.SymmetricKeySize]byte // used for encrypting cookies? PublicKey [gotox.PublicKeySize]byte PrivateKey [gotox.PrivateKeySize]byte }
func GenerateIdentity ¶
func (*Identity) DecryptPacket ¶
func (id *Identity) DecryptPacket(encrypted *EncryptedPacket) (*PlainPacket, error)
func (*Identity) Encrypt ¶
func (id *Identity) Encrypt(plain []byte, publicKey *[gotox.PublicKeySize]byte) (*[gotox.NonceSize]byte, []byte, error)
TODO: cache the shared key
func (*Identity) EncryptPacket ¶
func (id *Identity) EncryptPacket(plain *PlainPacket, publicKey *[gotox.PublicKeySize]byte) (*EncryptedPacket, error)
type LocalTransport ¶
type LocalTransport struct { ChOut *chan []byte ChIn *chan []byte ChStop chan struct{} Identity *Identity // contains filtered or unexported fields }
func NewLocalTransport ¶
func NewLocalTransport(id *Identity) (*LocalTransport, error)
func (*LocalTransport) DataChan ¶
func (t *LocalTransport) DataChan() chan TransportMessage
func (*LocalTransport) Listen ¶
func (t *LocalTransport) Listen()
func (*LocalTransport) Stop ¶
func (t *LocalTransport) Stop()
type PlainPacket ¶
type PlainPacket struct { Sender *[gotox.PublicKeySize]byte Payload Payload }
type Transport ¶
type Transport interface { Send(payload Payload, dest *DHTPeer) error Listen() Stop() DataChan() chan TransportMessage }
type TransportMessage ¶
type TransportMessage struct { Packet PlainPacket Addr net.UDPAddr }
type UDPTransport ¶
type UDPTransport struct { Server net.UDPConn Identity *Identity ChStop chan struct{} // contains filtered or unexported fields }
func NewUDPTransport ¶
func NewUDPTransport(id *Identity) (*UDPTransport, error)
func (*UDPTransport) DataChan ¶
func (t *UDPTransport) DataChan() chan TransportMessage
func (*UDPTransport) Listen ¶
func (t *UDPTransport) Listen()
func (*UDPTransport) Stop ¶
func (t *UDPTransport) Stop()
Click to show internal directories.
Click to hide internal directories.