diff options
author | Christopher Koch <c@chrisko.ch> | 2019-01-20 21:13:30 +0000 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2019-01-24 08:05:49 +0000 |
commit | a4a666c6477431358a1d6ed7b556398ed690ab5c (patch) | |
tree | d6b4c0e7a753db223d7d8b09569c4d028cff0f24 /dhcpv4/bsdp/bsdp_option_misc.go | |
parent | c90ab10024ada840e24bb028a3405961e8e4c26a (diff) |
dhcpv4: getters instead of getters
From:
r := GetRouter(d.Options)
To:
r := d.Router()
Diffstat (limited to 'dhcpv4/bsdp/bsdp_option_misc.go')
-rw-r--r-- | dhcpv4/bsdp/bsdp_option_misc.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/dhcpv4/bsdp/bsdp_option_misc.go b/dhcpv4/bsdp/bsdp_option_misc.go index 2d3a7bf..e3193f0 100644 --- a/dhcpv4/bsdp/bsdp_option_misc.go +++ b/dhcpv4/bsdp/bsdp_option_misc.go @@ -18,31 +18,16 @@ func OptReplyPort(port uint16) dhcpv4.Option { return dhcpv4.Option{Code: OptionReplyPort, Value: dhcpv4.Uint16(port)} } -// GetReplyPort returns the BSDP reply port in o, if present. -func GetReplyPort(o dhcpv4.Options) (uint16, error) { - return dhcpv4.GetUint16(OptionReplyPort, o) -} - // OptServerPriority returns a new BSDP server priority option. func OptServerPriority(prio uint16) dhcpv4.Option { return dhcpv4.Option{Code: OptionServerPriority, Value: dhcpv4.Uint16(prio)} } -// GetServerPriority returns the BSDP server priority in o if present. -func GetServerPriority(o dhcpv4.Options) (uint16, error) { - return dhcpv4.GetUint16(OptionServerPriority, o) -} - // OptMachineName returns a BSDP Machine Name option. func OptMachineName(name string) dhcpv4.Option { return dhcpv4.Option{Code: OptionMachineName, Value: dhcpv4.String(name)} } -// GetMachineName finds and parses the BSDP Machine Name option from o. -func GetMachineName(o dhcpv4.Options) string { - return dhcpv4.GetString(OptionMachineName, o) -} - // Version is the BSDP protocol version. Can be one of 1.0 or 1.1. type Version [2]byte @@ -75,24 +60,6 @@ func OptVersion(version Version) dhcpv4.Option { return dhcpv4.Option{Code: OptionVersion, Value: version} } -// GetVersion returns the BSDP version in o if present. -func GetVersion(o dhcpv4.Options) (Version, error) { - v := o.Get(OptionVersion) - if v == nil { - return Version{0, 0}, fmt.Errorf("version not found") - } - var ver Version - if err := ver.FromBytes(v); err != nil { - return Version{0, 0}, err - } - return ver, nil -} - -// GetServerIdentifier returns the BSDP Server Identifier value in o. -func GetServerIdentifier(o dhcpv4.Options) net.IP { - return dhcpv4.GetIP(OptionServerIdentifier, o) -} - // OptServerIdentifier returns a new BSDP Server Identifier option. func OptServerIdentifier(ip net.IP) dhcpv4.Option { return dhcpv4.Option{Code: OptionServerIdentifier, Value: dhcpv4.IP(ip)} |