Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) GetConnectionStatus() ConnectionStatus
- func (c *Client) GetCurrentDomain() string
- func (c *Client) GetNetworkStats() NetworkStats
- func (c *Client) GetServerInfo() map[string]interface{}
- func (c *Client) GetSessionInfo() *SessionInfo
- func (c *Client) GetTrafficStats() (totalDownload, totalUpload int64)
- func (c *Client) GetTunnelInfo() map[string]interface{}
- func (c *Client) GetVersion() string
- func (c *Client) IsConnected() bool
- func (c *Client) IsTunnelRunning() bool
- func (c *Client) Reconnect(ctx context.Context) error
- func (c *Client) SendSpeedData(ctx context.Context, downloadSpeed, uploadSpeed int64, pingMs int64) error
- func (c *Client) SetSocketProtector(protector func(fd int) bool)
- func (c *Client) SetTrafficCallback(callback TrafficCallback)
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) StartProxies() error
- func (c *Client) StartTunnelFromFD(fd int, mtu int) error
- func (c *Client) Stop()
- func (c *Client) StopTunnel() error
- func (c *Client) UpdatePing(pingMs int64)
- func (c *Client) UpdateSpeed(downloadSpeed, uploadSpeed int64)
- func (c *Client) UpdateTraffic(download, upload int64)
- type ClientError
- type ConnectionStatus
- type NetworkStats
- type SessionInfo
- type TrafficCallback
Constants ¶
This section is empty.
Variables ¶
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
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
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
GetTrafficStats returns total traffic statistics
func (*Client) GetTunnelInfo ¶ added in v0.3.5
GetTunnelInfo returns information about the TUN tunnel.
func (*Client) GetVersion ¶ added in v0.3.2
GetVersion returns the current SDK version
func (*Client) IsConnected ¶ added in v0.3.2
IsConnected returns true if client is connected
func (*Client) IsTunnelRunning ¶ added in v0.3.5
IsTunnelRunning returns true if the TUN tunnel is currently running.
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) SetSocketProtector ¶ added in v0.3.5
SetSocketProtector sets the socket protector callback for Android VpnService. This must be called before Start() if using protected sockets. The protector function will be called with each socket fd before dialing.
func (*Client) SetTrafficCallback ¶ added in v0.3.2
func (c *Client) SetTrafficCallback(callback TrafficCallback)
SetTrafficCallback sets a callback for traffic updates
func (*Client) StartProxies ¶
StartProxies starts the local proxy servers
func (*Client) StartTunnelFromFD ¶ added in v0.3.5
StartTunnelFromFD starts the Android TUN tunnel with the given file descriptor. This is an alternative to enabling TUN in config - can be called at runtime. fd: TUN file descriptor from VpnService mtu: MTU for TUN interface (0 for default 1500)
func (*Client) StopTunnel ¶ added in v0.3.5
StopTunnel stops the Android TUN tunnel.
func (*Client) UpdatePing ¶ added in v0.3.2
UpdatePing updates the ping value This function can be called to update ping via MTP
func (*Client) UpdateSpeed ¶ added in v0.3.2
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
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