mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-06-22 02:39:55 -04:00
move proxy.Dialer to internet.Dialer
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/transport/internet"
|
||||
"v2ray.com/core/transport/pipe"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
|
||||
}
|
||||
|
||||
// Process implements OutboundHandler.Dispatch().
|
||||
func (h *Handler) Process(ctx context.Context, link *vio.Link, dialer proxy.Dialer) error {
|
||||
func (h *Handler) Process(ctx context.Context, link *vio.Link, dialer internet.Dialer) error {
|
||||
nBytes := h.response.WriteTo(link.Writer)
|
||||
if nBytes > 0 {
|
||||
// Sleep a little here to make sure the response is sent to client.
|
||||
|
||||
@@ -87,7 +87,7 @@ func isValidAddress(addr *net.IPOrDomain) bool {
|
||||
}
|
||||
|
||||
// Process implements proxy.Outbound.
|
||||
func (h *Handler) Process(ctx context.Context, link *vio.Link, dialer proxy.Dialer) error {
|
||||
func (h *Handler) Process(ctx context.Context, link *vio.Link, dialer internet.Dialer) error {
|
||||
outbound := session.OutboundFromContext(ctx)
|
||||
if outbound == nil || !outbound.Target.IsValid() {
|
||||
return newError("target not specified.")
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"v2ray.com/core/common/session"
|
||||
"v2ray.com/core/common/task"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
@@ -20,7 +20,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
|
||||
return &Client{}, nil
|
||||
}
|
||||
|
||||
func (c *Client) Process(ctx context.Context, link *vio.Link, dialer proxy.Dialer) error {
|
||||
func (c *Client) Process(ctx context.Context, link *vio.Link, dialer internet.Dialer) error {
|
||||
outbound := session.OutboundFromContext(ctx)
|
||||
if outbound == nil || !outbound.Target.IsValid() {
|
||||
return newError("unknown destination.")
|
||||
|
||||
@@ -27,13 +27,7 @@ type Inbound interface {
|
||||
// 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, *vio.Link, Dialer) error
|
||||
}
|
||||
|
||||
// Dialer is used by OutboundHandler for creating outbound connections.
|
||||
type Dialer interface {
|
||||
// Dial dials a system connection to the given destination.
|
||||
Dial(ctx context.Context, destination net.Destination) (internet.Connection, error)
|
||||
Process(context.Context, *vio.Link, internet.Dialer) error
|
||||
}
|
||||
|
||||
// UserManager is the interface for Inbounds and Outbounds that can manage their users.
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"v2ray.com/core/common/task"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/features/policy"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
@@ -47,7 +46,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
|
||||
}
|
||||
|
||||
// Process implements OutboundHandler.Process().
|
||||
func (c *Client) Process(ctx context.Context, link *vio.Link, dialer proxy.Dialer) error {
|
||||
func (c *Client) Process(ctx context.Context, link *vio.Link, dialer internet.Dialer) error {
|
||||
outbound := session.OutboundFromContext(ctx)
|
||||
if outbound == nil || !outbound.Target.IsValid() {
|
||||
return newError("target not specified")
|
||||
|
||||
@@ -4,19 +4,17 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common/session"
|
||||
"v2ray.com/core/common/task"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/features/policy"
|
||||
|
||||
"v2ray.com/core"
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/retry"
|
||||
"v2ray.com/core/common/session"
|
||||
"v2ray.com/core/common/signal"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/common/task"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/features/policy"
|
||||
"v2ray.com/core/transport/internet"
|
||||
)
|
||||
|
||||
@@ -48,7 +46,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
|
||||
}
|
||||
|
||||
// Process implements proxy.Outbound.Process.
|
||||
func (c *Client) Process(ctx context.Context, link *vio.Link, dialer proxy.Dialer) error {
|
||||
func (c *Client) Process(ctx context.Context, link *vio.Link, dialer internet.Dialer) error {
|
||||
outbound := session.OutboundFromContext(ctx)
|
||||
if outbound == nil || !outbound.Target.IsValid() {
|
||||
return newError("target not specified.")
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"v2ray.com/core/common/task"
|
||||
"v2ray.com/core/common/vio"
|
||||
"v2ray.com/core/features/policy"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
"v2ray.com/core/proxy/vmess/encoding"
|
||||
"v2ray.com/core/transport/internet"
|
||||
@@ -53,7 +52,7 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
|
||||
}
|
||||
|
||||
// Process implements proxy.Outbound.Process().
|
||||
func (v *Handler) Process(ctx context.Context, link *vio.Link, dialer proxy.Dialer) error {
|
||||
func (v *Handler) Process(ctx context.Context, link *vio.Link, dialer internet.Dialer) error {
|
||||
var rec *protocol.ServerSpec
|
||||
var conn internet.Connection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user