Skip to content

Commit 6ba011a

Browse files
committed
netlink: allow setting hostname from netlink params
This allow the user to set the hostname for a device by using the Hostname netlink param. It also sets a more sensible default value than the Ssid name. Signed-off-by: deadprogram <ron@hybridgroup.com>
1 parent 94cb753 commit 6ba011a

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.4
44

55
require (
66
github.com/soypat/lneto v0.1.1-0.20260527165357-24d5d303bcb8
7-
tinygo.org/x/drivers v0.35.0
7+
tinygo.org/x/drivers v0.35.1-0.20260604174950-1d695a231aef
88
)
99

1010
require github.com/soypat/natiu-mqtt v0.6.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ github.com/soypat/lneto v0.1.1-0.20260527165357-24d5d303bcb8 h1:w0XI6cvLwkR+7FQa
22
github.com/soypat/lneto v0.1.1-0.20260527165357-24d5d303bcb8/go.mod h1:Be5PjwoYukvHFiUXxpYi8+ppH2F/gw/vjGBvFdv+Ti8=
33
github.com/soypat/natiu-mqtt v0.6.0 h1:ddrem9iAqFYtQOx2C7AhCizhPXXmGZs1T5fkvLroPO4=
44
github.com/soypat/natiu-mqtt v0.6.0/go.mod h1:xEta+cwop9izVCW7xOx2W+ct9PRMqr0gNVkvBPnQTc4=
5-
tinygo.org/x/drivers v0.35.0 h1:cTK36tsI/S4Mg3hCPH0MBjV/ta7XKQ+wpvch4mVqgsE=
6-
tinygo.org/x/drivers v0.35.0/go.mod h1:DQgKyHkB4G6IEOKVTAjApbKnWGwESN91EVJO+nMOE9Y=
5+
tinygo.org/x/drivers v0.35.1-0.20260604174950-1d695a231aef h1:nG/qd6hSQonHse2l8DYUrCuJSiCfcFD9n8YMze8sVo0=
6+
tinygo.org/x/drivers v0.35.1-0.20260604174950-1d695a231aef/go.mod h1:DQgKyHkB4G6IEOKVTAjApbKnWGwESN91EVJO+nMOE9Y=

netlink/netlink.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"tinygo.org/x/espradio"
1414
)
1515

16+
const defaultHostname = "tinygo-espradio"
17+
1618
const pollTime = 5 * time.Millisecond
1719

1820
var pollBackoff = lneto.BackoffStrategy(func(_ uint) time.Duration {
@@ -93,8 +95,11 @@ func (n *Esplink) NetConnect(params *nl.ConnectParams) error {
9395
return err
9496
}
9597

98+
if len(params.Hostname) == 0 {
99+
params.Hostname = defaultHostname
100+
}
96101
espstack, err := espradio.NewStack(nd, espradio.StackConfig{
97-
Hostname: params.Ssid,
102+
Hostname: params.Hostname,
98103
MaxUDPPorts: 2,
99104
MaxTCPPorts: 1,
100105
PassivePeers: 255,

0 commit comments

Comments
 (0)