Documentation ¶
Index ¶
- Constants
- func NewClient(serverconn net.Conn, remoteip string, remoteport int) *client
- func SetErrorHandle(errhandle func(error))
- func StartServer(listenaddr string, listenport int) error
- type Ack
- type BasicRandomNumberGenerator
- type CipherEnum
- type Encryptor
- type HelloMessage
- type RandomNumberGenerator
- type RemoteConnectionInfo
Constants ¶
View Source
const ( Code_Error byte = iota Code_Success )
Variables ¶
This section is empty.
Functions ¶
func SetErrorHandle ¶
func SetErrorHandle(errhandle func(error))
func StartServer ¶
Types ¶
type BasicRandomNumberGenerator ¶
type BasicRandomNumberGenerator struct{}
func (*BasicRandomNumberGenerator) Init ¶
func (brng *BasicRandomNumberGenerator) Init()
func (*BasicRandomNumberGenerator) Read ¶
func (brng *BasicRandomNumberGenerator) Read(b []byte)
type CipherEnum ¶
type CipherEnum = byte
const ( CipherPlain CipherEnum = iota CipherAes256GCM CipherChaCha20poly1305 )
type Encryptor ¶
type Encryptor interface { Key([]byte) Encryptor Encrypt(plaintext, dst []byte) ([]byte, error) Decrypt(ciphertext, dst []byte) ([]byte, error) NonceSize() int }
func GetEncryptor ¶
func GetEncryptor(enum CipherEnum, key []byte) Encryptor
type HelloMessage ¶
type HelloMessage struct {
// contains filtered or unexported fields
}
func (*HelloMessage) GetBytes ¶
func (hm *HelloMessage) GetBytes() []byte
func (*HelloMessage) GetMessage ¶
func (hm *HelloMessage) GetMessage() string
func (*HelloMessage) SetBytes ¶
func (hm *HelloMessage) SetBytes(b []byte)
func (*HelloMessage) SetMessage ¶
func (hm *HelloMessage) SetMessage(s string)
type RandomNumberGenerator ¶
type RandomNumberGenerator interface {
Read([]byte)
}
type RemoteConnectionInfo ¶
type RemoteConnectionInfo struct {
// contains filtered or unexported fields
}
func (*RemoteConnectionInfo) GetInfo ¶
func (info *RemoteConnectionInfo) GetInfo() (remoteip string, remoteport int)
func (*RemoteConnectionInfo) GetSize ¶
func (info *RemoteConnectionInfo) GetSize() int
func (*RemoteConnectionInfo) SetInfo ¶
func (info *RemoteConnectionInfo) SetInfo(remoteip string, remoteport int)
Click to show internal directories.
Click to hide internal directories.