mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-27 00:55:41 +08:00
24 lines
417 B
Go
24 lines
417 B
Go
package route
|
|
|
|
import (
|
|
"github.com/sagernet/sing-box/adapter"
|
|
)
|
|
|
|
var _ RuleItem = (*NetworkItem)(nil)
|
|
|
|
type NetworkItem struct {
|
|
network string
|
|
}
|
|
|
|
func NewNetworkItem(network string) *NetworkItem {
|
|
return &NetworkItem{network}
|
|
}
|
|
|
|
func (r *NetworkItem) Match(metadata *adapter.InboundContext) bool {
|
|
return r.network == metadata.Network
|
|
}
|
|
|
|
func (r *NetworkItem) String() string {
|
|
return "network=" + r.network
|
|
}
|