add router handler & connector

This commit is contained in:
ginuerzh
2025-02-07 15:44:31 +08:00
parent 379d9a73ad
commit 355c72477a
25 changed files with 1265 additions and 110 deletions
+26
View File
@@ -0,0 +1,26 @@
package ip
import (
"fmt"
"github.com/songgao/water/waterutil"
)
var prots = map[waterutil.IPProtocol]string{
waterutil.HOPOPT: "HOPOPT",
waterutil.ICMP: "ICMP",
waterutil.IGMP: "IGMP",
waterutil.GGP: "GGP",
waterutil.TCP: "TCP",
waterutil.UDP: "UDP",
waterutil.IPv6_Route: "IPv6-Route",
waterutil.IPv6_Frag: "IPv6-Frag",
waterutil.IPv6_ICMP: "IPv6-ICMP",
}
func Protocol(p waterutil.IPProtocol) string {
if v, ok := prots[p]; ok {
return v
}
return fmt.Sprintf("unknown(%d)", p)
}