package main import ( "forge.cadoles.com/Cadoles/owrt" ) func main() { uci := owrt.NewUCI() uci.LoadWirelessConf() wifaces := uci.GetWifiIfaces() wDevices := uci.GetWifiDevices() PyxisDevice := wDevices[0] ClientDevice := wDevices[1] for _, iface := range wifaces { iface.Delete(uci) } // Main Pyxis Interface pyxis := owrt.NewUCIWirelessInterface() pyxis.Name = "Pyxis-Network" pyxis.Network = "pyxis" pyxis.Index = 0 pyxis.Ssid = "Pyxis" pyxis.SysDevName = "wlan0" pyxis.Encryption = "psk2" pyxis.Key = "xxxxxxxxx" pyxis.Device = PyxisDevice["Device"] pyxis.DevicePath = PyxisDevice["Path"] pyxis.Mode = "ap" _ = pyxis.Create(uci) _ = pyxis.Save(uci) // Client Interface client := owrt.NewUCIWirelessInterface() client.Name = "Client-Network" client.Index = 1 client.SysDevName = "wlan1" client.Device = ClientDevice["Device"] client.DevicePath = ClientDevice["Path"] client.Mode = "sta" _ = client.Create(uci) _ = client.SysAdd(uci) _ = client.Up(uci) scan := client.Scan() for _, elm := range scan { if elm.Ssid == "Cadoles" { client.Connect(uci, elm, "xxxxxx") } } dhcp := owrt.NewDhcpClient(client.SysDevName) dhcp.AskForIP() }