mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
v1.0.0
This commit is contained in:
parent
47d23e9972
commit
c7f7c08ead
711 changed files with 82154 additions and 2 deletions
48
proxy/proxy.go
Normal file
48
proxy/proxy.go
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Package proxy contains all proxies used by Xray.
|
||||
//
|
||||
// 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"
|
||||
|
||||
"github.com/xtls/xray-core/v1/common/net"
|
||||
"github.com/xtls/xray-core/v1/common/protocol"
|
||||
"github.com/xtls/xray-core/v1/features/routing"
|
||||
"github.com/xtls/xray-core/v1/transport"
|
||||
"github.com/xtls/xray-core/v1/transport/internet"
|
||||
)
|
||||
|
||||
// An Inbound processes inbound connections.
|
||||
type Inbound interface {
|
||||
// Network returns a list of networks that this inbound supports. Connections with not-supported networks will not be passed into Process().
|
||||
Network() []net.Network
|
||||
|
||||
// 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 {
|
||||
// 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue