client

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilClient        = &ClientError{"client is nil"}
	ErrAlreadyConnected = &ClientError{"already connected"}
	ErrNotConnected     = &ClientError{"not connected"}
)

Errors

Functions

This section is empty.

Types

type Client

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

Client represents the Mimic Protocol client

func NewClient

func NewClient(cfg *config.ClientConfig) (*Client, error)

NewClient creates a new Mimic client instance

func (*Client) GetConnectionStatus added in v0.3.2

func (c *Client) GetConnectionStatus() ConnectionStatus

GetConnectionStatus returns the current connection status

func (*Client) GetCurrentDomain added in v0.3.2

func (c *Client) GetCurrentDomain() string

GetCurrentDomain returns the currently active disguise domain

func (*Client) GetNetworkStats added in v0.3.2

func (c *Client) GetNetworkStats() NetworkStats

GetNetworkStats returns current network statistics (speed, ping, total traffic)

func (*Client) GetServerInfo added in v0.3.2

func (c *Client) GetServerInfo() map[string]interface{}

GetServerInfo returns server configuration info

func (*Client) GetSessionInfo added in v0.3.2

func (c *Client) GetSessionInfo() *SessionInfo

GetSessionInfo returns current session information

func (*Client) GetTrafficStats added in v0.3.2

func (c *Client) GetTrafficStats() (totalDownload, totalUpload int64)

GetTrafficStats returns total traffic statistics

func (*Client) GetVersion added in v0.3.2

func (c *Client) GetVersion() string

GetVersion returns the current SDK version

func (*Client) IsConnected added in v0.3.2

func (c *Client) IsConnected() bool

IsConnected returns true if client is connected

func (*Client) Reconnect added in v0.3.2

func (c *Client) Reconnect(ctx context.Context) error

Reconnect disconnects and reconnects to the server

func (*Client) SendSpeedData added in v0.3.2

func (c *Client) SendSpeedData(ctx context.Context, downloadSpeed, uploadSpeed int64, pingMs int64) error

SendSpeedData sends speed and ping data to the server via MTP This is the main function requested for sending data through MTP protocol

func (*Client) SetTrafficCallback added in v0.3.2

func (c *Client) SetTrafficCallback(callback TrafficCallback)

SetTrafficCallback sets a callback for traffic updates

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

Start connects to the MTP server

func (*Client) StartProxies

func (c *Client) StartProxies() error

StartProxies starts the local proxy servers

func (*Client) Stop

func (c *Client) Stop()

Stop gracefully disconnects from the server

func (*Client) UpdatePing added in v0.3.2

func (c *Client) UpdatePing(pingMs int64)

UpdatePing updates the ping value This function can be called to update ping via MTP

func (*Client) UpdateSpeed added in v0.3.2

func (c *Client) UpdateSpeed(downloadSpeed, uploadSpeed int64)

UpdateSpeed updates the download/upload speed This function can be called to update speed statistics via MTP

func (*Client) UpdateTraffic added in v0.3.2

func (c *Client) UpdateTraffic(download, upload int64)

UpdateTraffic updates total traffic counters

type ClientError added in v0.3.2

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

ClientError represents a client error

func (*ClientError) Error added in v0.3.2

func (e *ClientError) Error() string

type ConnectionStatus added in v0.3.2

type ConnectionStatus int32

ConnectionStatus represents the current connection state

const (
	StatusDisconnected ConnectionStatus = iota
	StatusConnecting
	StatusConnected
	StatusReconnecting
)

func (ConnectionStatus) String added in v0.3.2

func (s ConnectionStatus) String() string

String returns the string representation of ConnectionStatus

type NetworkStats added in v0.3.2

type NetworkStats struct {
	DownloadSpeed int64 // bytes per second
	UploadSpeed   int64 // bytes per second
	Ping          int64 // milliseconds
	TotalDownload int64 // total bytes received
	TotalUpload   int64 // total bytes sent
	LastUpdated   time.Time
}

NetworkStats holds network statistics

type SessionInfo added in v0.3.2

type SessionInfo struct {
	ConnectedAt   time.Time
	ServerAddress string
	ServerName    string
	UUID          string
	Transport     string
	CurrentDomain string
	Status        ConnectionStatus
	Uptime        time.Duration
}

SessionInfo holds current session information

type TrafficCallback added in v0.3.2

type TrafficCallback func(stats NetworkStats)

TrafficCallback is a function type for traffic updates

Jump to

Keyboard shortcuts

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