Files
sing-box-extended-mirror/adapter/outbound.go
T

53 lines
1.3 KiB
Go
Raw Normal View History

2022-06-30 21:27:56 +08:00
package adapter
import (
2024-11-02 00:39:02 +08:00
"context"
2025-08-15 12:45:06 +08:00
"net/netip"
2025-02-17 22:00:57 +08:00
"time"
2024-11-02 00:39:02 +08:00
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
2025-02-17 22:00:57 +08:00
"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
2022-07-03 23:23:18 +08:00
Network() []string
2023-06-13 22:38:05 +08:00
Dependencies() []string
2022-07-03 13:14:49 +08:00
N.Dialer
2022-06-30 21:27:56 +08:00
}
2024-11-02 00:39:02 +08:00
2025-08-15 12:45:06 +08:00
type OutboundWithPreferredRoutes interface {
2025-02-17 22:00:57 +08:00
Outbound
2025-08-15 12:45:06 +08:00
PreferredDomain(domain string) bool
PreferredAddress(address netip.Addr) bool
}
2026-07-25 13:05:31 +08:00
type OutboundWithMultiplex interface {
Outbound
MultiplexEnabled() bool
}
2025-02-17 22:00:57 +08:00
type DirectRouteOutbound interface {
Outbound
NewDirectRouteConnection(metadata InboundContext, routeContext tun.DirectRouteContext, timeout time.Duration) (tun.DirectRouteDestination, error)
}
2024-11-02 00:39:02 +08:00
type OutboundRegistry interface {
option.OutboundOptionsRegistry
CreateOutbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Outbound, error)
}
2024-11-09 21:16:11 +08:00
type OutboundManager interface {
2024-11-10 16:46:59 +08:00
Lifecycle
2024-11-09 21:16:11 +08:00
Outbounds() []Outbound
Outbound(tag string) (Outbound, bool)
Default() Outbound
Remove(tag string) error
Create(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) error
}