client

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: GPL-3.0 Imports: 20 Imported by: 1

Documentation

Overview

Package client provides mieru client APIs for third party applications to integrate mieru protocol.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoClientConfig              = errors.New("no client config")
	ErrInvalidConfigConfig         = errors.New("invalid client config")
	ErrClientIsNotRunning          = errors.New("client is not running")
	ErrStoreClientConfigAfterStart = errors.New("can't store client config after start")
)

Functions

This section is empty.

Types

type Client

Client contains methods supported by a mieru client.

func NewClient

func NewClient() Client

NewClient creates a blank mieru client with no client config.

type ClientConfig

type ClientConfig struct {
	Profile  *appctlpb.ClientProfile
	Resolver apicommon.DNSResolver
}

ClientConfig stores proxy client configuration.

type ClientConfigurationService

type ClientConfigurationService interface {
	// Load returns the client config.
	// It returns ErrNoClientConfig if client config is never stored.
	Load() (*ClientConfig, error)

	// Store saves the client config.
	// It returns wrapped ErrInvalidConfigConfig if the provided client config is invalid.
	Store(*ClientConfig) error
}

ClientConfigurationService contains methods to manage proxy client configuration.

type ClientLifecycleService

type ClientLifecycleService interface {
	// Start activates the client with the stored configuration.
	// Calling Start function more than once has undefined behavior.
	Start() error

	// Stop deactivates the client.
	// Established network connections are NOT terminated.
	// After stop, the client can't be reused.
	Stop() error

	// IsRunning returns true if the client has been started
	// and has not been stopped.
	IsRunning() bool
}

ClientLifecycleService contains methods to manage proxy client lifecycle.

type ClientNetworkService

type ClientNetworkService interface {
	// DialContext returns a new proxy connection to reach the destination.
	// It returns an error if the client has not been started,
	// or has been stopped.
	DialContext(context.Context, net.Addr) (net.Conn, error)

	// DialContextWithConn is similar to DialContext, but use the given
	// connection to establish a new proxy connection.
	DialContextWithConn(context.Context, net.Conn, net.Addr) (net.Conn, error)
}

ClientNetworkService contains methods to establish connections to destinations using proxy servers.

Jump to

Keyboard shortcuts

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