protocol

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptAESGCM

func DecryptAESGCM(key []byte, ciphertext []byte) ([]byte, error)

DecryptAESGCM is deprecated, use DecryptChaCha20Poly1305 instead Kept for backward compatibility with legacy code Deprecated: Use DecryptChaCha20Poly1305 for better performance and security

func DecryptChaCha20Poly1305 added in v0.3.5

func DecryptChaCha20Poly1305(key []byte, ciphertext []byte) ([]byte, error)

DecryptChaCha20Poly1305 decrypts ciphertext using ChaCha20-Poly1305 Expects format: [nonce(24 bytes)][ciphertext+tag]

func DeriveKey

func DeriveKey(secret string) []byte

DeriveKey creates a 32-byte key from a string (e.g., UUID) using SHA-256 The derived key is suitable for ChaCha20-Poly1305

func EncryptAESGCM

func EncryptAESGCM(key []byte, plaintext []byte) ([]byte, error)

EncryptAESGCM is deprecated, use EncryptChaCha20Poly1305 instead Kept for backward compatibility with legacy code Deprecated: Use EncryptChaCha20Poly1305 for better performance and security

func EncryptChaCha20Poly1305 added in v0.3.5

func EncryptChaCha20Poly1305(key []byte, plaintext []byte) ([]byte, error)

EncryptChaCha20Poly1305 encrypts plaintext using ChaCha20-Poly1305 Returns: [nonce(24 bytes)][ciphertext+tag]

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection wraps a net.Conn with Mimic protocol logic

func Dial

func Dial(address string, secret string) (*Connection, error)

Dial connects to the remote address using protected dialer. Uses Android VpnService protection when available.

func NewConnection

func NewConnection(conn net.Conn, secret string) *Connection

NewConnection creates a new Mimic connection wrapper

func (*Connection) Close

func (c *Connection) Close() error

Close closes the underlying connection

func (*Connection) GenerateFakeClientHello

func (c *Connection) GenerateFakeClientHello(sni string, sessionID string) ([]byte, error)

GenerateFakeClientHello leverages uTLS to generate a robust Chrome fingerprint

func (*Connection) HandshakeClient

func (c *Connection) HandshakeClient(sni string, sessionID string) error

HandshakeClient performs the client-side handshake

func (*Connection) HandshakeServer

func (c *Connection) HandshakeServer() (string, string, []byte, error)

HandshakeServer peeks at the ClientHello. Returns SNI, SessionID, the peeked hello bytes, and error.

func (*Connection) LocalAddr

func (c *Connection) LocalAddr() net.Addr

LocalAddr returns the local network address

func (*Connection) Read

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

Read reads data, stripping the TLS 1.3 Application Data record framing

func (*Connection) ReadTLSRecord

func (c *Connection) ReadTLSRecord() ([]byte, error)

ReadTLSRecord reads a TLS 1.3 Application Data record

func (*Connection) RemoteAddr

func (c *Connection) RemoteAddr() net.Addr

RemoteAddr returns the remote network address

func (*Connection) SetDeadline

func (c *Connection) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines

func (*Connection) SetReadDeadline

func (c *Connection) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls

func (*Connection) SetWriteDeadline

func (c *Connection) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls

func (*Connection) Write

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

Write sends data, wrapping it in a TLS 1.3 Application Data record

func (*Connection) WriteTLSRecord

func (c *Connection) WriteTLSRecord(payload []byte) error

WriteTLSRecord wraps payload in a TLS 1.3 Application Data record

type Protocol

type Protocol interface {
	// Handshake establishes a secure connection with the server
	Handshake() error
	// Send transmits data with the current mimicry pattern
	Send(data []byte) (int, error)
	// Receive reads data from the connection
	Receive() ([]byte, error)
}

Protocol defines the core interface for the Mimic protocol. It handles the obfuscation and transmission of data.

Jump to

Keyboard shortcuts

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