client

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: BSD-2-Clause Imports: 10 Imported by: 1

Documentation

Overview

Package client exposes a proxy that uses obfs4 to communicate with the server, with an optional KCP wire transport.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning = errors.New("already initialized")
	ErrNotRunning     = errors.New("server not running")
	ErrBadConfig      = errors.New("configuration error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	ProxyAddr string

	EventLogger EventLogger
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, stop context.CancelFunc, config Config) *Client

func NewFFIClient added in v1.0.0

func NewFFIClient(jsonConfig string) (*Client, error)

NewFFIClient creates a new client This function is exposed to the JNI and since it's not allowed to pass objects that contain slices (other than byte slices) over the JNI we have to pass a json formatted string and convert it to a Config struct for further processing

func (*Client) IsStarted

func (c *Client) IsStarted() bool

func (*Client) Start

func (c *Client) Start() (bool, error)

func (*Client) Stop

func (c *Client) Stop() (bool, error)

type Config

type Config struct {
	ProxyAddr     string             `json:"proxy_addr"`
	HoppingConfig HoppingConfig      `json:"hopping_config"`
	KCPConfig     obfsvpn.KCPConfig  `json:"kcp_config"`
	QUICConfig    obfsvpn.QUICConfig `json:"quic_config"`
	RemoteIP      string             `json:"remote_ip"`
	RemotePort    string             `json:"remote_port"`
	Obfs4Cert     string             `json:"obfs4_cert"`
}

type EventLogger

type EventLogger interface {
	Log(state string, message string)
	Error(message string)
}

type HoppingConfig

type HoppingConfig struct {
	Enabled       bool     `json:"enabled"`
	Remotes       []string `json:"remotes"`
	Obfs4Certs    []string `json:"obfs4_certs"`
	PortSeed      int64    `json:"port_seed"`
	PortCount     uint     `json:"port_count"`
	MinHopSeconds uint     `json:"min_hop_seconds"`
	HopJitter     uint     `json:"hop_jitter"`
}

type Obfs4Config

type Obfs4Config struct {
	Remote string
	Cert   string
}

func (*Obfs4Config) String

func (oc *Obfs4Config) String() string

type Obfs4Conn added in v1.2.0

type Obfs4Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewObfs4Conn added in v1.2.0

func NewObfs4Conn(conn net.Conn, config Obfs4Config) *Obfs4Conn

Jump to

Keyboard shortcuts

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