{"id":14978070,"url":"https://github.com/mark2b/wpa-connect","last_synced_at":"2025-10-28T07:31:18.941Z","repository":{"id":14126013,"uuid":"76066870","full_name":"mark2b/wpa-connect","owner":"mark2b","description":"wpa-connect","archived":false,"fork":false,"pushed_at":"2022-04-03T21:03:14.000Z","size":45,"stargazers_count":61,"open_issues_count":2,"forks_count":20,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-01T12:45:29.346Z","etag":null,"topics":["go","golang","raspberry-pi","wpa-supplicant"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mark2b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-09T20:13:03.000Z","updated_at":"2024-02-09T19:14:32.000Z","dependencies_parsed_at":"2022-08-07T07:16:21.272Z","dependency_job_id":null,"html_url":"https://github.com/mark2b/wpa-connect","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2Fwpa-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2Fwpa-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2Fwpa-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mark2b%2Fwpa-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mark2b","download_url":"https://codeload.github.com/mark2b/wpa-connect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238614459,"owners_count":19501461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","raspberry-pi","wpa-supplicant"],"created_at":"2024-09-24T13:56:49.269Z","updated_at":"2025-10-28T07:31:18.661Z","avatar_url":"https://github.com/mark2b.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wpa-connect\n## Package provides API for connection Linux device to Wi-Fi Network.\n\n\n**wpa-connect** communicates with WPA supplicant over D-Bus (linux message bus system).\n\n\nThis package was developed as part of IoT project in order to add Wi-Fi connectivity to headless Raspberry Pi like devices. No need for **connman** or **Network Manager** be installed. \n\n\n## Setup\n\n**On Linux:**\n\n**wpa_supplicant** service should run with **-u** flag in order to enable DBus interface. Run it as Linux service before first call to **wpa_supplicant**. Otherwise system will start it automatically without **-u** flag. \n\nSystemd service configuration file - **/etc/systemd/system/wpa_supplicant@wlan0.service**\n```\n[Unit]\nDescription=WPA supplicant for %i\n\n[Service]\nExecStart=/usr/sbin/wpa_supplicant -u -i%i -c/etc/wpa_supplicant.conf -Dwext\n\n[Install]\nWantedBy=multi-user.target\n```\n\n**On Raspberry PI OS (Debian Buster):**\n\n**Raspbery PI OS** (formerely known as Raspbian) uses [dhcpd-run-hooks](https://manpages.debian.org/stretch/dhcpcd5/dhcpcd-run-hooks.8.en.html) to setup and invoke the wpa_supplicant daemon. \n\n1. Disable the systemd managed wpa_supplicant located under `/etc/systemd/dbus-fi.w1.wpa_supplicant1.service` by running `sudo systemctl disable wpa_supplicant`\n1. Modify the existing wpa_supplicant dhcpd-run-hook available under `/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant` by adding the `-u` flag to the invocation of the wpa_supplicant daemon in the `wpa_supplicant_start()` function. \n1. Alternatively run `sudo sed -i 's/wpa_supplicant -B/wpa_supplicant -u -B/g' /lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant` to modify the hook in place.\n\n**On Project:**\n\n```\ngo get github.com/mark2b/wpa-connect\n```\n\n## Usage\nPlease see [godoc.org](http://godoc.org/wpa-connect) for documentation. (Not ready yet)\n\n## Examples\n\n### Connect to Wi-Fi network\n\n \n```golang\nimport wifi \"wpa-connect\"\n\nif conn, err := wifi.ConnectManager.Connect(ssid, password, time.Second * 60); err == nil {\n\tfmt.Println(\"Connected\", conn.NetInterface, conn.SSID, conn.IP4.String(), conn.IP6.String())\n} else {\n\tfmt.Println(err)\n}\n```\n### Scan for Wi-Fi networks\n\n```golang\nimport wifi \"wpa-connect\"\n\nif bssList, err := wifi.ScanManager.Scan(); err == nil {\n\tfor _, bss := range bssList {\n\t\tprint(bss.SSID, bss.Signal, bss.KeyMgmt)\n\t}\n}\n```\n\nPackage release under a [MIT license](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark2b%2Fwpa-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmark2b%2Fwpa-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark2b%2Fwpa-connect/lists"}