cipher_conn

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

README

Cipher Connection

  • The cipher_conn package provides encrypted connections using an AEAD cipher. Supported ciphers are ChaCha20-Poly1305, AES-256-GCM, AES-192-GCM, and AES-128-GCM, which can be specified in the config file.

  • The Gordafarid protocol uses this package for communication after the client's Initial Greeting.

  • Encrypted Packet Schema:

    Field Packet Length Nonce Encrypted Message
    Size(Byte) 2 Variable(AEAD Nonce Size) Variable
    • Packet Length: Indicates the total length of the following data (Nonce + Encrypted Message).
    • Nonce: A unique value for each message to ensure security
    • Encrypted Message: The actual message content, encrypted using the AEAD cipher.

      NOTICE: The Encrypted Messge could be the Gordafarid protocol handshake packet during the handshake process or the actual application data.

Documentation

Overview

The cipher_conn package provides encrypted connection using the AEAD cipher.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CipherConn

type CipherConn struct {
	net.Conn // Underlying TCP connection, like a telephone line
	// contains filtered or unexported fields
}

CipherConn wraps a net.Conn and encrypts/decrypts using an AEAD cipher. It's like a secret decoder ring for your network messages!

func WrapConnToCipherConn

func WrapConnToCipherConn(conn net.Conn, aead cipher.AEAD) *CipherConn

func (*CipherConn) Read

func (c *CipherConn) Read(b []byte) (int, error)

Read reads from the underlying connection, decrypting the data. It's like receiving a secret message and decoding it!

func (*CipherConn) Write

func (c *CipherConn) Write(b []byte) (int, error)

Write encrypts the data and writes to the underlying connection. It's like encoding a secret message and sending it!

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL