Documentation ¶
Index ¶
- Constants
- func AESDecrypt(key []byte, data []byte) []byte
- func AESDeriveKey(pass []byte, salt []byte) []byte
- func AESEncrypt(key []byte, data []byte) []byte
- func Deserialise[T any](data []byte) *T
- func GenerateProfile(user, pass, path string) error
- func GenerateValue32() []byte
- func RSABytesToPrivKey(key []byte) (*rsa.PrivateKey, error)
- func RSABytesToPubKey(key []byte) (*rsa.PublicKey, error)
- func RSADecrypt(priv *rsa.PrivateKey, data []byte) []byte
- func RSAEncrypt(pub *rsa.PublicKey, data []byte) []byte
- func RSAGenerateKeys() (*rsa.PrivateKey, *rsa.PublicKey)
- func RSAPrivKeyToBytes(key *rsa.PrivateKey) []byte
- func RSAPubKeyToBytes(key *rsa.PublicKey) []byte
- func RSASign(priv *rsa.PrivateKey, data []byte) []byte
- func RSAVerify(pub *rsa.PublicKey, data []byte, sig []byte) bool
- func RemoveEndpoint(list *[]*Endpoint, index int)
- func RemoveServerEndpoint(list *[]*ServerEndpoint, index int)
- func SHA256Hash(data []byte) []byte
- func Serialise[T any](t *T) []byte
- type AcceptData
- type Authenticator
- type Callbacks
- type Client
- type ClientListData
- type ConnectData
- type Endpoint
- type MessageData
- type Server
- type ServerConfig
- type ServerEndpoint
- type Transmission
Constants ¶
View Source
const ( ADDR_INTERN string = "127.0.0.1" ADDR_ALL string = "0.0.0.0" TCP_PORT string = "14400" MAGIC_VAL string = "mutiiny" SEP_VAL string = "*/MSEP/*" HEADER_SIZE uint8 = 8 HEADER_PAD uint8 = 2 MESSAGE_DATA uint16 = 0 CONNECT_DATA uint16 = 1 QUIT_DATA uint16 = 2 ACCEPT_DATA uint16 = 3 DENY_DATA uint16 = 4 CLIENT_DATA uint16 = 5 ENCODE_TEXT string = "TEXT" ENCODE_PNG string = "PNG" ENCODE_FILE string = "FILE" )
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶
func AESDeriveKey ¶
func AESEncrypt ¶
func Deserialise ¶
func GenerateProfile ¶
func GenerateValue32 ¶
func GenerateValue32() []byte
func RSABytesToPrivKey ¶
func RSABytesToPrivKey(key []byte) (*rsa.PrivateKey, error)
func RSADecrypt ¶
func RSADecrypt(priv *rsa.PrivateKey, data []byte) []byte
func RSAGenerateKeys ¶
func RSAGenerateKeys() (*rsa.PrivateKey, *rsa.PublicKey)
func RSAPrivKeyToBytes ¶
func RSAPrivKeyToBytes(key *rsa.PrivateKey) []byte
func RSAPubKeyToBytes ¶
func RemoveEndpoint ¶
func RemoveServerEndpoint ¶
func RemoveServerEndpoint(list *[]*ServerEndpoint, index int)
func SHA256Hash ¶
Types ¶
type AcceptData ¶
type AcceptData struct { Name string PublicKey *rsa.PublicKey Signature []byte SessionKey []byte Config *ServerConfig }
func NewAcceptData ¶
func NewAcceptData(auth *Authenticator, config *ServerConfig, sk []byte) *AcceptData
type Authenticator ¶
type Authenticator struct { Name string PublicKey *rsa.PublicKey PrivateKey *rsa.PrivateKey }
func LoadProfile ¶
func LoadProfile(user, pass, path string) (*Authenticator, error)
type Callbacks ¶
type Callbacks struct { OnRecieve func(*Transmission, *ServerEndpoint) OnAccept func(*ServerEndpoint) OnRemove func(*ServerEndpoint) }
type Client ¶
type Client struct { Callbacks *Callbacks Servers []*ServerEndpoint Alive bool *Authenticator }
func (*Client) WaitForQuit ¶
func (c *Client) WaitForQuit()
type ClientListData ¶
type ClientListData struct {
Names []string
}
func NewClientListData ¶
func NewClientListData(clients []*Endpoint) *ClientListData
func (*ClientListData) Print ¶
func (cl *ClientListData) Print()
type ConnectData ¶
func NewConnectData ¶
func NewConnectData(auth *Authenticator) *ConnectData
type Endpoint ¶
type Endpoint struct { Name string SessionKey []byte PublicKey *rsa.PublicKey Conn net.Conn Ready bool }
func GetEndpointFromConn ¶
func (*Endpoint) Recieve ¶
func (e *Endpoint) Recieve() (*Transmission, error)
func (*Endpoint) Transmit ¶
func (e *Endpoint) Transmit(tm *Transmission) error
type MessageData ¶
func NewTextMessage ¶
func NewTextMessage(sender, channel, text string) *MessageData
func (*MessageData) Print ¶
func (m *MessageData) Print()
type Server ¶
type Server struct { Listener net.Listener Clients []*Endpoint Alive bool *Authenticator *ServerConfig }
func NewServer ¶
func NewServer(user, pass, path, address string, config *ServerConfig) (*Server, error)
func (*Server) Broadcast ¶
func (s *Server) Broadcast(tm *Transmission)
type ServerConfig ¶
type ServerConfig struct {
Channels []string
}
type ServerEndpoint ¶
type ServerEndpoint struct { *Endpoint *ServerConfig }
func GetServerEndpointFromConn ¶
func GetServerEndpointFromConn(list *[]*ServerEndpoint, conn net.Conn) (int, *ServerEndpoint)
type Transmission ¶
func NewTransmission ¶
func NewTransmission[T any](dataType uint16, data *T) *Transmission
func (*Transmission) Decrypt ¶
func (tm *Transmission) Decrypt(key []byte) *Transmission
func (*Transmission) Encrypt ¶
func (tm *Transmission) Encrypt(key []byte) *Transmission
func (*Transmission) Print ¶
func (tm *Transmission) Print()
Click to show internal directories.
Click to hide internal directories.