[Issue #6] - added config option to enable/disable icmp packets
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -8,6 +8,9 @@ const (
|
|||||||
WifiSSID = "My Wifi Name"
|
WifiSSID = "My Wifi Name"
|
||||||
WifiPass = "SecretWifiPassword"
|
WifiPass = "SecretWifiPassword"
|
||||||
|
|
||||||
|
// Networking settings
|
||||||
|
EnableICMP = true
|
||||||
|
|
||||||
MQTTHost = "192.168.1.50" // Must be an IP address; DNS resolution is not supported currently
|
MQTTHost = "192.168.1.50" // Must be an IP address; DNS resolution is not supported currently
|
||||||
MQTTPort = "1883"
|
MQTTPort = "1883"
|
||||||
MQTTUser = "" // Leave empty if not required
|
MQTTUser = "" // Leave empty if not required
|
||||||
|
|||||||
@@ -120,11 +120,15 @@ func InitNetwork(ssid, pass string) (*NetworkStack, error) {
|
|||||||
MaxActiveTCPPorts: 2,
|
MaxActiveTCPPorts: 2,
|
||||||
MTU: uint16(framelen - ethernet.MaxOverheadSize),
|
MTU: uint16(framelen - ethernet.MaxOverheadSize),
|
||||||
HardwareAddress: hwaddr,
|
HardwareAddress: hwaddr,
|
||||||
|
ICMPQueueLimit: 4,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("stack config reset: %w", err)
|
return nil, fmt.Errorf("stack config reset: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable network pings if configured
|
||||||
|
_ = stack.EnableICMP(EnableICMP)
|
||||||
|
|
||||||
// Start background frame pump
|
// Start background frame pump
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
go stackLoop(ctx, stack, adapter)
|
go stackLoop(ctx, stack, adapter)
|
||||||
|
|||||||
Reference in New Issue
Block a user