rule_item_ip_accept_any.go 412 B

123456789101112131415161718192021
  1. package rule
  2. import (
  3. "github.com/sagernet/sing-box/adapter"
  4. )
  5. var _ RuleItem = (*IPAcceptAnyItem)(nil)
  6. type IPAcceptAnyItem struct{}
  7. func NewIPAcceptAnyItem() *IPAcceptAnyItem {
  8. return &IPAcceptAnyItem{}
  9. }
  10. func (r *IPAcceptAnyItem) Match(metadata *adapter.InboundContext) bool {
  11. return len(metadata.DestinationAddresses) > 0
  12. }
  13. func (r *IPAcceptAnyItem) String() string {
  14. return "ip_accept_any=true"
  15. }