Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithClientID(ctx context.Context, clientID ClientID) context.Context
- func ContextWithProxyAuthorization(ctx context.Context, auth *url.Userinfo) context.Context
- func NetTransport(rw1, rw2 io.ReadWriter) error
- func ProxyAuthorizationFromContext(ctx context.Context) *url.Userinfo
- func Resolve(ctx context.Context, network, addr string, r Resolver, hosts HostMapper, ...) (string, error)
- type AuthOption
- type Authenticator
- type Bypass
- type BypassOption
- type BypassOptions
- type Chain
- type ChainOption
- type ChainRouteOption
- type Chainer
- type ChainerOption
- type ChainerOptions
- type ClientID
- type ConnectOption
- type Connector
- type ConnectorAuth
- type ConnectorOption
- type DialOptions
- type Dialer
- type DialerOption
- type HandleOption
- type HandleOptions
- type Handler
- type HandlerOption
- func WithHandlerAuth(auth *url.Userinfo) HandlerOption
- func WithHandlerAuther(auther Authenticator) HandlerOption
- func WithHandlerBypass(bypass Bypass) HandlerOption
- func WithHandlerLogger(logger *logger.Logger) HandlerOption
- func WithHandlerRouter(router *Router) HandlerOption
- func WithHandlerTLSConfig(tlsConfig *tls.Config) HandlerOption
- func WithProxyOnly() HandlerOption
- type HostMapper
- type HostsOption
- type Listener
- type ListenerOption
- type NetDialer
- type Node
- type NodeOption
- type NodeOptions
- type Resolver
- type ResolverOption
- type Route
- type RouteDialOption
- type Router
- type RouterOption
- func WithRouterChainer(chain Chainer) RouterOption
- func WithRouterHostMapper(m HostMapper) RouterOption
- func WithRouterLogger(logger *logger.Logger) RouterOption
- func WithRouterResolver(resolver Resolver) RouterOption
- func WithRouterRetriesOption(retries int) RouterOption
- func WithRouterTimeout(timeout time.Duration) RouterOption
- type RouterOptions
- type Service
- type ServiceOption
- type TcpDialerOption
- type TlsDialer
- type Transport
- type TransportOption
- type TransportOptions
Constants ¶
View Source
const (
DefaultTimeout = 10 * time.Second
)
Variables ¶
View Source
var (
DefaultNetDialer = &NetDialer{}
)
View Source
var (
DefaultTlsDialer = &TlsDialer{}
)
View Source
var (
ErrInvalidResolver = errors.New("invalid resolver")
)
Functions ¶
func ContextWithClientID ¶
func NetTransport ¶
func NetTransport(rw1, rw2 io.ReadWriter) error
Types ¶
type AuthOption ¶
type AuthOption func(opts *authOptions)
type Authenticator ¶
type Bypass ¶
type Bypass interface {
Contains(ctx context.Context, network, addr string, opts ...BypassOption) bool
}
func BypassGroup ¶
type BypassOption ¶
type BypassOption func(opts *BypassOptions)
func WithBypassHost ¶
func WithBypassHost(host string) BypassOption
func WithBypassPath ¶
func WithBypassPath(path string) BypassOption
type BypassOptions ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func NewChain ¶
func NewChain(name string, opts ...ChainOption) *Chain
type ChainOption ¶
type ChainOption func(*chainOptions)
func WithChainLogger ¶
func WithChainLogger(logger *logger.Logger) ChainOption
type ChainRouteOption ¶
type ChainRouteOption func(*chainRouteOptions)
func WithChainRouteChainerOption ¶
func WithChainRouteChainerOption(c Chainer) ChainRouteOption
type Chainer ¶
type Chainer interface {
Route(ctx context.Context, network, address string, opts ...ChainerOption) Route
}
type ChainerOption ¶
type ChainerOption func(opts *ChainerOptions)
func ChainerHostOption ¶
func ChainerHostOption(host string) ChainerOption
type ChainerOptions ¶
type ChainerOptions struct {
Host string
}
type ConnectOption ¶
type ConnectOption func(opts *connectOptions)
func NetDialerConnectOption ¶
func NetDialerConnectOption(netd *NetDialer) ConnectOption
type Connector ¶
type Connector interface {
Connect(ctx context.Context, conn net.Conn, network, address string, opts ...ConnectOption) (net.Conn, error)
}
func NewHttpConnector ¶
func NewHttpConnector(opts ...ConnectorOption) Connector
type ConnectorOption ¶
type ConnectorOption func(opts *connectorOptions)
func WithConnectorAuth ¶
func WithConnectorAuth(auth ConnectorAuth) ConnectorOption
func WithConnectorConnectTimeout ¶
func WithConnectorConnectTimeout(connectTimeout time.Duration) ConnectorOption
func WithConnectorLogger ¶
func WithConnectorLogger(logger *logger.Logger) ConnectorOption
func WithConnectorTLSConfig ¶
func WithConnectorTLSConfig(tlsConfig *tls.Config) ConnectorOption
type DialOptions ¶
type Dialer ¶
type Dialer interface {
Dial(ctx context.Context, addr string, opts ...DialerOption) (net.Conn, error)
}
func NewTcpDialer ¶
func NewTcpDialer(opts ...TcpDialerOption) Dialer
type DialerOption ¶
type DialerOption func(opts *DialOptions)
func WithDialerHostOption ¶
func WithDialerHostOption(host string) DialerOption
func WithDialerNetDialer ¶
func WithDialerNetDialer(netd *NetDialer) DialerOption
type HandleOption ¶
type HandleOption func(opts *HandleOptions)
type HandleOptions ¶
type HandleOptions struct { }
type Handler ¶
func NewHttpHandler ¶
func NewHttpHandler(opts ...HandlerOption) Handler
type HandlerOption ¶
type HandlerOption func(opts *handlerOptions)
func WithHandlerAuth ¶
func WithHandlerAuth(auth *url.Userinfo) HandlerOption
func WithHandlerAuther ¶
func WithHandlerAuther(auther Authenticator) HandlerOption
func WithHandlerBypass ¶
func WithHandlerBypass(bypass Bypass) HandlerOption
func WithHandlerLogger ¶
func WithHandlerLogger(logger *logger.Logger) HandlerOption
func WithHandlerRouter ¶
func WithHandlerRouter(router *Router) HandlerOption
func WithHandlerTLSConfig ¶
func WithHandlerTLSConfig(tlsConfig *tls.Config) HandlerOption
func WithProxyOnly ¶
func WithProxyOnly() HandlerOption
type HostMapper ¶
type HostsOption ¶
type HostsOption func(opts *hostsOptions)
type Listener ¶
type Listener interface { Init(ctx context.Context) error Accept() (net.Conn, error) Addr() net.Addr Close() error }
func NewTcpListener ¶
func NewTcpListener(opts ...ListenerOption) Listener
type ListenerOption ¶
type ListenerOption func(opts *listenerOptions)
func WithListenerAddr ¶
func WithListenerAddr(addr string) ListenerOption
func WithListenerLogger ¶
func WithListenerLogger(logger *logger.Logger) ListenerOption
func WithListenerTLSConfig ¶
func WithListenerTLSConfig(tlsConfig *tls.Config) ListenerOption
type NetDialer ¶
type NodeOption ¶
type NodeOption func(*NodeOptions)
func WithNodeHostMapper ¶
func WithNodeHostMapper(m HostMapper) NodeOption
func WithNodeResolver ¶
func WithNodeResolver(resolver Resolver) NodeOption
func WithNodeTransport ¶
func WithNodeTransport(tr *Transport) NodeOption
type NodeOptions ¶
type NodeOptions struct { Transport *Transport Resolver Resolver HostMapper HostMapper }
type ResolverOption ¶
type ResolverOption func(opts *resolverOptions)
type Route ¶
type Route interface { Dial(ctx context.Context, network, address string, opts ...RouteDialOption) (net.Conn, error) Nodes() []*Node }
var (
DefaultRoute Route = &defaultRoute{}
)
type RouteDialOption ¶
type RouteDialOption func(opts *routeDialOptions)
func WithRouteDialLogger ¶
func WithRouteDialLogger(logger *logger.Logger) RouteDialOption
func WithRouteDialTimeout ¶
func WithRouteDialTimeout(d time.Duration) RouteDialOption
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(opts ...RouterOption) *Router
func (*Router) Options ¶
func (r *Router) Options() *RouterOptions
type RouterOption ¶
type RouterOption func(*RouterOptions)
func WithRouterChainer ¶
func WithRouterChainer(chain Chainer) RouterOption
func WithRouterHostMapper ¶
func WithRouterHostMapper(m HostMapper) RouterOption
func WithRouterLogger ¶
func WithRouterLogger(logger *logger.Logger) RouterOption
func WithRouterResolver ¶
func WithRouterResolver(resolver Resolver) RouterOption
func WithRouterRetriesOption ¶
func WithRouterRetriesOption(retries int) RouterOption
func WithRouterTimeout ¶
func WithRouterTimeout(timeout time.Duration) RouterOption
type RouterOptions ¶
type Service ¶
func NewService ¶
func NewService(ln Listener, h Handler, opts ...ServiceOption) Service
type ServiceOption ¶
type ServiceOption func(opts *serviceOptions)
func WithServiceLogger ¶
func WithServiceLogger(logger *logger.Logger) ServiceOption
type TcpDialerOption ¶
type TcpDialerOption func(opts *tcpDialerOptions)
func WithTcpDialerLogger ¶
func WithTcpDialerLogger(logger *logger.Logger) TcpDialerOption
type TlsDialer ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTransport ¶
func NewTransport(d Dialer, c Connector, opts ...TransportOption) *Transport
func (*Transport) Options ¶
func (tr *Transport) Options() *TransportOptions
type TransportOption ¶
type TransportOption func(*TransportOptions)
func WithTransportAddr ¶
func WithTransportAddr(addr string) TransportOption
func WithTransportRoute ¶
func WithTransportRoute(route Route) TransportOption
func WithTransportTimeout ¶
func WithTransportTimeout(timeout time.Duration) TransportOption
Click to show internal directories.
Click to hide internal directories.