sing-box/adapter/outbound.go

34 lines
840 B
Go
Raw Permalink Normal View History

2022-06-30 21:27:56 +08:00
package adapter
import (
2024-11-02 00:39:02 +08:00
"context"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
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
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
type OutboundRegistry interface {
option.OutboundOptionsRegistry
CreateOutbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Outbound, error)
}
type OutboundManager interface {
Lifecycle
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
}