sing-box/adapter/outbound.go

26 lines
626 B
Go
Raw Normal View History

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