mirror of
https://github.com/danderson/netboot.git
synced 2025-10-15 17:41:38 +02:00
Appease golint some more with docstrings and unexporting of functions.
This commit is contained in:
parent
1404193a39
commit
6061bfbc73
@ -3,11 +3,13 @@ package pixiecore
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go.universe.tf/netboot/dhcp6"
|
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.universe.tf/netboot/dhcp6"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ServerV6 boots machines using a Booter.
|
||||||
type ServerV6 struct {
|
type ServerV6 struct {
|
||||||
Address string
|
Address string
|
||||||
Port string
|
Port string
|
||||||
@ -23,6 +25,7 @@ type ServerV6 struct {
|
|||||||
Debug func(subsystem, msg string)
|
Debug func(subsystem, msg string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewServerV6 returns a new ServerV6.
|
||||||
func NewServerV6() *ServerV6 {
|
func NewServerV6() *ServerV6 {
|
||||||
ret := &ServerV6{
|
ret := &ServerV6{
|
||||||
Port: "547",
|
Port: "547",
|
||||||
@ -30,6 +33,8 @@ func NewServerV6() *ServerV6 {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Serve listens for machines attempting to boot, and responds to
|
||||||
|
// their DHCPv6 requests.
|
||||||
func (s *ServerV6) Serve() error {
|
func (s *ServerV6) Serve() error {
|
||||||
s.log("dhcp", "starting...")
|
s.log("dhcp", "starting...")
|
||||||
|
|
||||||
@ -47,7 +52,7 @@ func (s *ServerV6) Serve() error {
|
|||||||
// blocking.
|
// blocking.
|
||||||
s.errs = make(chan error, 6)
|
s.errs = make(chan error, 6)
|
||||||
|
|
||||||
s.SetDUID(dhcp.SourceHardwareAddress())
|
s.setDUID(dhcp.SourceHardwareAddress())
|
||||||
|
|
||||||
go func() { s.errs <- s.serveDHCP(dhcp) }()
|
go func() { s.errs <- s.serveDHCP(dhcp) }()
|
||||||
|
|
||||||
@ -81,7 +86,7 @@ func (s *ServerV6) debug(subsystem, format string, args ...interface{}) {
|
|||||||
s.Debug(subsystem, fmt.Sprintf(format, args...))
|
s.Debug(subsystem, fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServerV6) SetDUID(addr net.HardwareAddr) {
|
func (s *ServerV6) setDUID(addr net.HardwareAddr) {
|
||||||
duid := make([]byte, len(addr)+8) // see rfc3315, section 9.2, DUID-LT
|
duid := make([]byte, len(addr)+8) // see rfc3315, section 9.2, DUID-LT
|
||||||
|
|
||||||
copy(duid[0:], []byte{0, 1}) //fixed, x0001
|
copy(duid[0:], []byte{0, 1}) //fixed, x0001
|
||||||
|
Loading…
x
Reference in New Issue
Block a user