outbound.go 840 B

123456789101112131415161718192021222324252627282930313233
  1. package adapter
  2. import (
  3. "context"
  4. "github.com/sagernet/sing-box/log"
  5. "github.com/sagernet/sing-box/option"
  6. N "github.com/sagernet/sing/common/network"
  7. )
  8. // Note: for proxy protocols, outbound creates early connections by default.
  9. type Outbound interface {
  10. Type() string
  11. Tag() string
  12. Network() []string
  13. Dependencies() []string
  14. N.Dialer
  15. }
  16. type OutboundRegistry interface {
  17. option.OutboundOptionsRegistry
  18. CreateOutbound(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) (Outbound, error)
  19. }
  20. type OutboundManager interface {
  21. Lifecycle
  22. Outbounds() []Outbound
  23. Outbound(tag string) (Outbound, bool)
  24. Default() Outbound
  25. Remove(tag string) error
  26. Create(ctx context.Context, router Router, logger log.ContextLogger, tag string, outboundType string, options any) error
  27. }