mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-10 18:38:22 +00:00
use newer netip types
This commit is contained in:
parent
d4fc2116b5
commit
627a1105ee
3 changed files with 4 additions and 8 deletions
|
@ -2,15 +2,14 @@ package network
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"nfsense.net/nfsense/internal/definitions/common"
|
||||
"net/netip"
|
||||
)
|
||||
|
||||
type Interface struct {
|
||||
Alias string `json:"alias,omitempty" validate:"min=0,max=3"`
|
||||
Type InterfaceType `json:"type" validate:"min=0,max=3"`
|
||||
AddressingMode InterfaceAddressingMode `json:"addressing_mode" validate:"min=0,max=2"`
|
||||
Address *common.IPCIDR `json:"address,omitempty" validate:"excluded_unless=AddressingMode 1"`
|
||||
Address *netip.Prefix `json:"address,omitempty" validate:"excluded_unless=AddressingMode 1"`
|
||||
HardwareDevice *string `json:"hardware_device,omitempty"`
|
||||
// TODO fix Validator for int pointers with min=0,max=4094
|
||||
VlanID *uint `json:"vlan_id,omitempty"`
|
||||
|
|
|
@ -2,14 +2,12 @@ package network
|
|||
|
||||
import (
|
||||
"net/netip"
|
||||
|
||||
"nfsense.net/nfsense/internal/definitions/common"
|
||||
)
|
||||
|
||||
type StaticRoute struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Interface string `json:"interface,omitempty"`
|
||||
Gateway netip.Addr `json:"gateway,omitempty"`
|
||||
Destination common.IPNet `json:"destination,omitempty"`
|
||||
Destination netip.Prefix `json:"destination,omitempty"`
|
||||
Metric uint `json:"metric,omitempty"`
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"net/netip"
|
||||
|
||||
"go4.org/netipx"
|
||||
"nfsense.net/nfsense/internal/definitions/common"
|
||||
)
|
||||
|
||||
type Address struct {
|
||||
|
@ -13,7 +12,7 @@ type Address struct {
|
|||
Comment string `json:"comment,omitempty"`
|
||||
Host *netip.Addr `json:"host,omitempty" validate:"excluded_unless=Type 0"`
|
||||
Range *netipx.IPRange `json:"range,omitempty" validate:"excluded_unless=Type 1"`
|
||||
NetworkAddress *common.IPNet `json:"network,omitempty" validate:"excluded_unless=Type 2"`
|
||||
NetworkAddress *netip.Prefix `json:"network,omitempty" validate:"excluded_unless=Type 2"`
|
||||
Children *[]string `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue