-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
proxy.go
31 lines (26 loc) · 985 Bytes
/
proxy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Package proxy contains all proxies used by V2Ray.
package proxy // import "github.com/v2ray/v2ray-core/proxy"
import (
"github.com/v2ray/v2ray-core/common/alloc"
v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/transport/ray"
)
type HandlerState int
const (
HandlerStateStopped = HandlerState(0)
HandlerStateRunning = HandlerState(1)
)
// An InboundHandler handles inbound network connections to V2Ray.
type InboundHandler interface {
// Listen starts a InboundHandler by listen on a specific port.
Listen(port v2net.Port) error
// Close stops the handler to accepting anymore inbound connections.
Close()
// Port returns the port that the handler is listening on.
Port() v2net.Port
}
// An OutboundHandler handles outbound network connection for V2Ray.
type OutboundHandler interface {
// Dispatch sends one or more Packets to its destination.
Dispatch(destination v2net.Destination, payload *alloc.Buffer, ray ray.OutboundRay) error
}