package config import ( "flag" ) // declareFlags registers flags for the structure Options. func declareFlags(o *Config) { flag.StringVar(&o.Bind, "bind", ":8081", "Bind port/socket") flag.StringVar(&o.WifiInterface, "wifi-interface", "wlan0", "WiFi interface name") flag.StringVar(&o.HotspotInterface, "hotspot-interface", "wlan1", "Hotspot WiFi interface name") flag.StringVar(&o.WifiBackend, "wifi-backend", "", "WiFi backend to use: 'iwd' or 'wpasupplicant' (required)") flag.StringVar(&o.StationBackend, "station-backend", "hostapd", "Station discovery backend: 'arp', 'dhcp', or 'hostapd'") flag.StringVar(&o.DHCPLeasesPath, "dhcp-leases-path", "/var/lib/dhcp/dhcpd.leases", "Path to DHCP leases file") flag.StringVar(&o.ARPTablePath, "arp-table-path", "/proc/net/arp", "Path to ARP table file") flag.BoolVar(&o.SyslogEnabled, "syslog-enabled", false, "Enable syslog tailing for iwd messages") flag.StringVar(&o.SyslogPath, "syslog-path", "/var/log/messages", "Path to syslog file") flag.Var(&StringArray{&o.SyslogFilter}, "daemon.info iwd:", "Filter string for syslog lines") flag.StringVar(&o.SyslogSource, "syslog-source", "iwd", "Source name for syslog entries in logs") } // parseCLI parse the flags and treats extra args as configuration filename. func parseCLI(o *Config) error { flag.Parse() for _, conf := range flag.Args() { err := parseFile(o, conf) if err != nil { return err } } return nil }