parent
acb645aa9d
commit
272eee79fd
2 changed files with 8 additions and 2 deletions
|
@ -16,6 +16,7 @@ type Machine struct {
|
|||
ID uint64 `gorm:"primary_key"`
|
||||
MachineKey string `gorm:"type:varchar(64);unique_index"`
|
||||
NodeKey string
|
||||
DiscoKey string
|
||||
IPAddress string
|
||||
|
||||
Registered bool // temp
|
||||
|
@ -44,6 +45,10 @@ func (m Machine) toNode() (*tailcfg.Node, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dKey, err := wgcfg.ParseHexKey(m.DiscoKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addrs := []netaddr.IPPrefix{}
|
||||
allowedIPs := []netaddr.IPPrefix{}
|
||||
|
||||
|
@ -81,6 +86,7 @@ func (m Machine) toNode() (*tailcfg.Node, error) {
|
|||
Key: tailcfg.NodeKey(nKey),
|
||||
KeyExpiry: *m.Expiry,
|
||||
Machine: tailcfg.MachineKey(mKey),
|
||||
DiscoKey: tailcfg.DiscoKey(dKey),
|
||||
Addresses: addrs,
|
||||
AllowedIPs: allowedIPs,
|
||||
Endpoints: endpoints,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue