Documentation
¶
Overview ¶
Package gordafarid implements the Gordafarid protocol, a custom network protocol for secure communication.
Package gordafarid implements the Gordafarid protocol for secure communication.
Package gordafarid implements the Gordafarid protocol, a custom network protocol for secure communication.
Index ¶
- Constants
- func Dial(addr string, dialAccountConfig *dialAccountConfig, ...) (net.Conn, error)
- func DialContext(ctx context.Context, addr string, dialAccountConfig *dialAccountConfig, ...) (net.Conn, error)
- func NewDialAccountConfig(account Credential, initPassword, cryptoAlgorithm string) *dialAccountConfig
- func NewDialConnConfig(addr *protocol.AddressHeader) *dialConnConfig
- func WrapTCP(conn net.Conn, dialAccountConfig *dialAccountConfig, ...) (net.Conn, error)
- func WrapTCPContext(ctx context.Context, conn net.Conn, dialAccountConfig *dialAccountConfig, ...) (net.Conn, error)
- type Config
- type Conn
- func (c *Conn) GetHandshakeComplete() bool
- func (c *Conn) GetHandshakeResult() (protocol.AddressHeader, error)
- func (c *Conn) Handshake() error
- func (c *Conn) HandshakeContext(ctx context.Context) error
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) SetHandshakeComplete()
- func (c *Conn) Write(b []byte) (int, error)
- type Credential
- type Dialer
- func (d *Dialer) Dial(dialConnConfig *dialConnConfig, addr string) (net.Conn, error)
- func (d *Dialer) DialContext(ctx context.Context, dialConnConfig *dialConnConfig, addr string) (net.Conn, error)
- func (d *Dialer) WrapTCP(dialConnConfig *dialConnConfig, conn net.Conn) (net.Conn, error)
- func (d *Dialer) WrapTCPContext(ctx context.Context, dialConnConfig *dialConnConfig, conn net.Conn) (net.Conn, error)
- type Hash
- type Listener
- type ServerConfig
Constants ¶
const ( // HashSize defines the size of the hash used in the greeting header. // It is set to the size of SHA-256 hash, which is 32 bytes. HashSize = sha256.Size )
Constants used in the Gordafarid protocol
const InitPasswordSize = 32
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(addr string, dialAccountConfig *dialAccountConfig, dialConnConfig *dialConnConfig) (net.Conn, error)
Dial establishes a Gordafarid connection using the background context.
func DialContext ¶
func DialContext(ctx context.Context, addr string, dialAccountConfig *dialAccountConfig, dialConnConfig *dialConnConfig) (net.Conn, error)
DialContext establishes a Gordafarid connection with the given context and configuration.
func NewDialAccountConfig ¶
func NewDialAccountConfig(account Credential, initPassword, cryptoAlgorithm string) *dialAccountConfig
NewDialAccountConfig creates a new DialAccountConfig instance.
func NewDialConnConfig ¶
func NewDialConnConfig(addr *protocol.AddressHeader) *dialConnConfig
NewDialConnConfig creates a new DialConnConfig instance.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds the internal connection's configuration.
type Conn ¶
type Conn struct { net.Conn // Embedded net.Conn for underlying network operations // contains filtered or unexported fields }
Conn represents a connection using the Gordafarid protocol. It wraps a standard net.Conn and adds protocol-specific functionality.
func (*Conn) GetHandshakeComplete ¶
GetHandshakeComplete returns the current handshake completion status. It returns true if the handshake has been completed, false otherwise.
func (*Conn) GetHandshakeResult ¶
func (c *Conn) GetHandshakeResult() (protocol.AddressHeader, error)
GetHandshakeResult returns the address header from the request after ensuring that the handshake is complete. This is useful for obtaining information about the client's requested destination.
func (*Conn) Handshake ¶
Handshake initiates the handshake process for the connection. It uses a background context and delegates to HandshakeContext.
func (*Conn) HandshakeContext ¶
HandshakeContext performs the handshake process with a provided context. The context allows for cancellation and timeout control of the handshake operation.
func (*Conn) Read ¶
Read reads data from the connection. It ensures that the handshake is complete before reading.
func (*Conn) SetHandshakeComplete ¶
func (c *Conn) SetHandshakeComplete()
SetHandshakeComplete marks the handshake as complete for the connection. This method is used to indicate that the initial handshake process has finished successfully.
type Credential ¶
Credential represents a username and password pair for authentication.
func NewCredential ¶
func NewCredential(username, password string) Credential
NewCredential creates a new Credential instance with the given username and password.
type Dialer ¶
Dialer represents a Gordafarid dialer for establishing connections.
func NewDialer ¶
func NewDialer(accountConfig *dialAccountConfig, connConfig *dialConnConfig) *Dialer
NewDialer creates a new Gordafarid Dialer instance.
func (*Dialer) DialContext ¶
func (d *Dialer) DialContext(ctx context.Context, dialConnConfig *dialConnConfig, addr string) (net.Conn, error)
DialContext establishes a Gordafarid connection to the specified address with the given context.
type Listener ¶
Listener wraps a net.Listener with Gordafarid-specific functionality.
func Listen ¶
func Listen(laddr string, config *ServerConfig) (*Listener, error)
Listen creates a new Gordafarid listener on the specified network address.
func NewListener ¶
func NewListener(underlyingListener net.Listener, config *ServerConfig) *Listener
NewListener creates a new Gordafarid Listener wrapping the provided net.Listener.
type ServerConfig ¶
type ServerConfig struct { Credentials []Credential // Server-side credentials for authentication EncryptionAlgorithm string // Encryption algorithm to be used InitPassword string // Initial password for decrypting the client's initial greeting HandshakeTimeout int // Server handshake timeout in seconds }
ServerConfig holds the configuration options for a Gordafarid server.
func NewServerConfig ¶
func NewServerConfig(credentials []Credential, encryptionAlgorithm, initPassword string, handshakeTimeout int) *ServerConfig
NewServerConfig creates a new ServerConfig instance with the provided parameters.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
The cipher_conn package provides encrypted connection using the AEAD cipher.
|
The cipher_conn package provides encrypted connection using the AEAD cipher. |
crypto
|
|
aead
Package aead package provides AEAD cryptographic functionality for the Gordafarid project.
|
Package aead package provides AEAD cryptographic functionality for the Gordafarid project. |
aes_gcm
Package aes_gcm provides encryption and decryption functions using AES-GCM.
|
Package aes_gcm provides encryption and decryption functions using AES-GCM. |
Package nonce_cache provides a mechanism for managing nonce storage and checking for replay attacks.
|
Package nonce_cache provides a mechanism for managing nonce storage and checking for replay attacks. |