mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-30 06:39:55 +07:00
feat: dns routing (#26)
This commit is contained in:
@ -41,6 +41,16 @@ func (l L4ProtoStr) ToL4Proto() uint8 {
|
||||
panic("unsupported l4proto")
|
||||
}
|
||||
|
||||
func (l L4ProtoStr) ToL4ProtoType() L4ProtoType {
|
||||
switch l {
|
||||
case L4ProtoStr_TCP:
|
||||
return L4ProtoType_TCP
|
||||
case L4ProtoStr_UDP:
|
||||
return L4ProtoType_UDP
|
||||
}
|
||||
panic("unsupported l4proto: " + l)
|
||||
}
|
||||
|
||||
type IpVersionStr string
|
||||
|
||||
const (
|
||||
@ -58,6 +68,16 @@ func (v IpVersionStr) ToIpVersion() uint8 {
|
||||
panic("unsupported ipversion")
|
||||
}
|
||||
|
||||
func (v IpVersionStr) ToIpVersionType() IpVersionType {
|
||||
switch v {
|
||||
case IpVersionStr_4:
|
||||
return IpVersion_4
|
||||
case IpVersionStr_6:
|
||||
return IpVersion_6
|
||||
}
|
||||
panic("unsupported ipversion")
|
||||
}
|
||||
|
||||
func IpVersionFromAddr(addr netip.Addr) IpVersionStr {
|
||||
var ipversion IpVersionStr
|
||||
switch {
|
||||
|
Reference in New Issue
Block a user