QoL feature - select best interface on current system
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

When generating a default config instead of using a canned value like "eth0", hypd will isntead look at what interfaces the system has and make a best guess based on progressively narrowing filters.
This commit is contained in:
2024-04-20 19:25:15 -06:00
parent 6b1bfb3a01
commit 0942fb132f
3 changed files with 93 additions and 2 deletions

View File

@@ -57,8 +57,16 @@ func LoadConfiguration(configFilePath string) (*HypdConfiguration, error) {
}
func DefaultConfig() *HypdConfiguration {
var ifaceString string
iface, err := getDefaultNIC()
if err == nil {
ifaceString = iface.Name
} else {
ifaceString = "enp0s3" // fallback to fixed value
}
return &HypdConfiguration{
NetworkInterface: "enp0s3",
NetworkInterface: ifaceString,
PreSharedKeyDirectory: "./secrets/",
SuccessAction: "iptables -A INPUT -p tcp -s %s --dport 22 -j ACCEPT",
TimeoutSeconds: 1440,