Documentation ¶
Index ¶
- Constants
- func HandshakeAsServerCha0(remaining []byte, conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, ...) ([]byte, []byte, uint16, error)
- type Device
- func (d *Device) DecryptInline(buffer *bufferio.BufferArray, startOffset int, sigFunc SignalFunc) error
- func (d *Device) DecryptPacketsFromReader(reader IOReader, sigFunc SignalFunc, outputBuffer *bufferio.BufferArray) error
- func (d *Device) EncryptInline(inputBuffer *bufferio.BufferArray) error
- func (device *Device) GetRecvStats(recv *RecvStats)
- func (d *Device) WriteSignal(signal uint32, ba *bufferio.BufferArray)
- type DeviceConf
- func HandshakeAsClientWithCha0(conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, ...) ([]byte, []byte, *DeviceConf, error)
- func HandshakeAsClientWithCha1(conn io.ReadWriter, remotePub ed25519.PublicKey, ...) ([]byte, []byte, *DeviceConf, error)
- func HandshakeAsServer(conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, ...) ([]byte, []byte, *DeviceConf, error)
- func HandshakeAsServerCha1(remaining []byte, conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, ...) ([]byte, []byte, *DeviceConf, error)
- type EncryptedCha1RequestHeader
- type EncryptedCha1ResponseHeader
- type IOFunc
- type IOReader
- type RecvStats
- type SignalFunc
Constants ¶
View Source
const ( PacketByteLimit = 1 << 25 PacketCommandMask = 1 << 63 )
View Source
const NonceRotationNum = 1 << 20
View Source
const (
SeqIDOutOfOrderThreshold = uint64(4096)
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func NewDevice ¶
func (*Device) DecryptInline ¶
func (d *Device) DecryptInline(buffer *bufferio.BufferArray, startOffset int, sigFunc SignalFunc) error
func (*Device) DecryptPacketsFromReader ¶
func (d *Device) DecryptPacketsFromReader(reader IOReader, sigFunc SignalFunc, outputBuffer *bufferio.BufferArray) error
DecryptPacketsFromReader decrypts one packet from `reader`. Most of the time, `input` will be called once per packet, but might be multiple if FEC recovers some missing packets. Returns EOF if `reader` returns EOF. Returns unexpected EOF if reader returns EOF while reading a packet.
func (*Device) EncryptInline ¶
func (d *Device) EncryptInline(inputBuffer *bufferio.BufferArray) error
func (*Device) GetRecvStats ¶
Returns receiver stats: raw packet missing, recovered by fec.
func (*Device) WriteSignal ¶
func (d *Device) WriteSignal(signal uint32, ba *bufferio.BufferArray)
Write signal ecrypts a signal, this signal will not be recovered by FEC.
type DeviceConf ¶
type DeviceConf struct {
FecTotal, FecParity int
}
func HandshakeAsClientWithCha0 ¶
func HandshakeAsClientWithCha0(conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, authFunc func(ed25519.PublicKey) bool, conf *DeviceConf) ([]byte, []byte, *DeviceConf, error)
func HandshakeAsClientWithCha1 ¶
func HandshakeAsClientWithCha1(conn io.ReadWriter, remotePub ed25519.PublicKey, authPrivateKey ed25519.PrivateKey, deviceConf *DeviceConf) ([]byte, []byte, *DeviceConf, error)
func HandshakeAsServer ¶
func HandshakeAsServer(conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, authFunc func(ed25519.PublicKey) bool, public bool) ([]byte, []byte, *DeviceConf, error)
func HandshakeAsServerCha1 ¶
func HandshakeAsServerCha1(remaining []byte, conn io.ReadWriter, authPrivateKey ed25519.PrivateKey, authFunc func(ed25519.PublicKey) bool) ([]byte, []byte, *DeviceConf, error)
type EncryptedCha1RequestHeader ¶
type EncryptedCha1RequestHeader struct { X25519PubKey []byte Ed25519PubKey []byte Nonce []byte Conf []byte Signature []byte }
The following fields are encrypted by ed25519 pubkey.
type EncryptedCha1ResponseHeader ¶
type IOFunc ¶
IOFunc specifies a functor for an I/O operation. `Data` is invalid when it is out of invoke call.
type IOReader ¶
type IOReader interface { io.Reader io.ByteReader }
type RecvStats ¶ added in v0.2.29
Click to show internal directories.
Click to hide internal directories.