sing-box/adapter/outbound.go

34 lines
840 B
Go
Raw Normal View History

2022-06-30 13:27:56 +00:00
package adapter
import (
2024-11-01 16:39:02 +00:00
"context"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
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
Network() []string
2023-06-13 14:38:05 +00:00
Dependencies() []string
2022-07-03 05:14:49 +00:00
N.Dialer
2022-06-30 13:27:56 +00:00
}
2024-11-01 16:39:02 +00: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
}