2022-06-30 13:27:56 +00:00
|
|
|
package adapter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net"
|
|
|
|
|
2023-03-21 13:36:17 +00:00
|
|
|
tun "github.com/sagernet/sing-tun"
|
2022-06-30 13:27:56 +00:00
|
|
|
N "github.com/sagernet/sing/common/network"
|
|
|
|
)
|
|
|
|
|
2022-07-29 16:29:22 +00:00
|
|
|
// Note: for proxy protocols, outbound creates early connections by default.
|
|
|
|
|
2022-06-30 13:27:56 +00:00
|
|
|
type Outbound interface {
|
|
|
|
Type() string
|
|
|
|
Tag() string
|
2022-07-03 15:23:18 +00:00
|
|
|
Network() []string
|
2022-07-03 05:14:49 +00:00
|
|
|
N.Dialer
|
2022-07-07 15:36:32 +00:00
|
|
|
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
|
|
|
|
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
|
2022-06-30 13:27:56 +00:00
|
|
|
}
|
2023-03-21 13:36:17 +00:00
|
|
|
|
|
|
|
type IPOutbound interface {
|
|
|
|
Outbound
|
|
|
|
NewIPConnection(ctx context.Context, conn tun.RouteContext, metadata InboundContext) (tun.DirectDestination, error)
|
|
|
|
}
|