router.go 673 B

1234567891011121314151617181920212223242526272829
  1. package adapter
  2. import (
  3. "context"
  4. "net"
  5. N "github.com/sagernet/sing/common/network"
  6. "github.com/sagernet/sing-box/common/geoip"
  7. "github.com/sagernet/sing-box/common/geosite"
  8. )
  9. type Router interface {
  10. Service
  11. Outbound(tag string) (Outbound, bool)
  12. DefaultOutbound(network string) Outbound
  13. RouteConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
  14. RoutePacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
  15. GeoIPReader() *geoip.Reader
  16. GeositeReader() *geosite.Reader
  17. }
  18. type Rule interface {
  19. Service
  20. UpdateGeosite() error
  21. Match(metadata *InboundContext) bool
  22. Outbound() string
  23. String() string
  24. }