You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/proxy/proxy.go

49 lines
1.5 KiB

// Package proxy contains all proxies used by V2Ray.
8 years ago
//
// 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.
package proxy
import (
"context"
8 years ago
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/features/routing"
"v2ray.com/core/transport"
"v2ray.com/core/transport/internet"
)
// An Inbound processes inbound connections.
type Inbound interface {
8 years ago
// Network returns a list of network that this inbound supports. Connections with not-supported networks will not be passed into Process().
Network() net.NetworkList
8 years ago
// 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, routing.Dispatcher) error
}
// An Outbound process outbound connections.
type Outbound interface {
8 years ago
// Process processes the given connection. The given dialer may be used to dial a system outbound connection.
Process(context.Context, *transport.Link, internet.Dialer) error
}
// UserManager is the interface for Inbounds and Outbounds that can manage their users.
type UserManager interface {
// AddUser adds a new user.
AddUser(context.Context, *protocol.MemoryUser) error
// RemoveUser removes a user by email.
RemoveUser(context.Context, string) error
}
type GetInbound interface {
GetInbound() Inbound
}
type GetOutbound interface {
GetOutbound() Outbound
7 years ago
}