proxy

package
v3.33.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package proxy contains all proxies used by V2Ray.

To implement an inbound or outbound proxy, one needs to do the following: 1. Implement the interface(s) below. 2. Register a config creator through common.RegisterConfig.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithInboundEntryPoint

func ContextWithInboundEntryPoint(ctx context.Context, dest net.Destination) context.Context

func ContextWithInboundTag

func ContextWithInboundTag(ctx context.Context, tag string) context.Context

func ContextWithOriginalTarget

func ContextWithOriginalTarget(ctx context.Context, dest net.Destination) context.Context

func ContextWithResolveIPs

func ContextWithResolveIPs(ctx context.Context, f IPResolver) context.Context

func ContextWithSource

func ContextWithSource(ctx context.Context, src net.Destination) context.Context

ContextWithSource creates a new context with given source.

func ContextWithTarget

func ContextWithTarget(ctx context.Context, dest net.Destination) context.Context

func InboundEntryPointFromContext

func InboundEntryPointFromContext(ctx context.Context) (net.Destination, bool)

func InboundTagFromContext

func InboundTagFromContext(ctx context.Context) (string, bool)

func OriginalTargetFromContext

func OriginalTargetFromContext(ctx context.Context) (net.Destination, bool)

func SourceFromContext

func SourceFromContext(ctx context.Context) (net.Destination, bool)

SourceFromContext retrieves source from the given context.

func TargetFromContext

func TargetFromContext(ctx context.Context) (net.Destination, bool)

Types

type Dialer

type Dialer interface {
	// Dial dials a system connection to the given destination.
	Dial(ctx context.Context, destination net.Destination) (internet.Connection, error)
}

Dialer is used by OutboundHandler for creating outbound connections.

type GetInbound added in v1.1.0

type GetInbound interface {
	GetInbound() Inbound
}

type GetOutbound added in v1.1.0

type GetOutbound interface {
	GetOutbound() Outbound
}

type IPResolver

type IPResolver interface {
	Resolve() []net.Address
}

func ResolvedIPsFromContext

func ResolvedIPsFromContext(ctx context.Context) (IPResolver, bool)

type Inbound added in v1.1.0

type Inbound interface {
	// Network returns a list of network that this inbound supports. Connections with not-supported networks will not be passed into Process().
	Network() net.NetworkList

	// Process processes a connection of given network. If necessary, the Inbound can dispatch the connection to an Outbound.
	Process(context.Context, net.Network, internet.Connection, core.Dispatcher) error
}

An Inbound processes inbound connections.

type Outbound added in v1.1.0

type Outbound interface {
	// Process processes the given connection. The given dialer may be used to dial a system outbound connection.
	Process(context.Context, *core.Link, Dialer) error
}

An Outbound process outbound connections.

type UserManager added in v1.1.0

type UserManager interface {
	// AddUser adds a new user.
	AddUser(context.Context, *protocol.User) error

	// RemoveUser removes a user by email.
	RemoveUser(context.Context, string) error
}

UserManager is the interface for Inbounds and Outbounds that can manage their users.

Directories

Path Synopsis
Package blackhole is an outbound handler that blocks all connections.
Package blackhole is an outbound handler that blocks all connections.
Package shadowsocks provides compatible functionality to Shadowsocks.
Package shadowsocks provides compatible functionality to Shadowsocks.
Package socks provides implements of Socks protocol 4, 4a and 5.
Package socks provides implements of Socks protocol 4, 4a and 5.
Package vmess contains the implementation of VMess protocol and transportation.
Package vmess contains the implementation of VMess protocol and transportation.

Jump to

Keyboard shortcuts

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