{"id":13574149,"url":"https://github.com/pgollangi/netselect","last_synced_at":"2025-04-22T12:36:47.425Z","repository":{"id":37035040,"uuid":"286984463","full_name":"pgollangi/netselect","owner":"pgollangi","description":"💻 A CLI tool and Go library to find the fastest site based on the lowest ICMP latency.","archived":false,"fork":false,"pushed_at":"2023-03-18T14:09:22.000Z","size":114,"stargazers_count":14,"open_issues_count":12,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-05T09:43:52.336Z","etag":null,"topics":["cli","command-line","command-line-tool","go","go-library","golang","golang-application","icmp-ping","netselect","ping"],"latest_commit_sha":null,"homepage":"https://pgollangi.github.io/netselect","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/pgollangi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-12T10:28:31.000Z","updated_at":"2024-10-12T16:12:15.000Z","dependencies_parsed_at":"2024-06-19T06:12:48.588Z","dependency_job_id":"08f16300-ce3b-4586-8c06-9249ba304219","html_url":"https://github.com/pgollangi/netselect","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2Fnetselect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2Fnetselect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2Fnetselect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgollangi%2Fnetselect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgollangi","download_url":"https://codeload.github.com/pgollangi/netselect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223896951,"owners_count":17221475,"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":["cli","command-line","command-line-tool","go","go-library","golang","golang-application","icmp-ping","netselect","ping"],"created_at":"2024-08-01T15:00:47.192Z","updated_at":"2024-11-10T00:11:24.749Z","avatar_url":"https://github.com/pgollangi.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"![build](https://github.com/pgollangi/netselect/workflows/build/badge.svg?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pgollangi/netselect)](https://goreportcard.com/report/github.com/pgollangi/netselect)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/pgollangi/netselect)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/pgollangi/netselect)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/pgollangi/netselect)](https://pkg.go.dev/github.com/pgollangi/netselect)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6236d95b7ca7a9554560/maintainability)](https://codeclimate.com/github/pgollangi/netselect/maintainability)\n[![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/pgollangi/netselect)](https://codeclimate.com/github/pgollangi/netselect/trends/technical_debt)\n![License: MIT](https://img.shields.io/github/license/pgollangi/netselect)\n[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/prassu158@gmail.com)\n# netselect\n\nA CLI tool as well as library to select the fastest host based on the lowest ICMP latency written in Go (golang), inspired by [apenwarr/netselect](https://github.com/apenwarr/netselect) debian package.\n\nIt’s a handy tool to choose a mirror for apt, or just to compare sites to each other. Under the hood it’s an ICMP ping.\n\n## Features\n- Finds the fastest host(s) in terms of network connectivity.\n- Run desired concurent findings to get faster results. Use flag `--concurrent`.  \n- Customize no. of ping attempt to perform for each host to get accurate mean response time. Use flag `--attempts`.\n- Display only top `n` results on output. Use flag `--output`.\n- Optionally, direct `netselect` to send \"unprivileged\" pings via UDP for non-sudo users. Use `--privileged=false`.\n\n## Usage\n`netselect` available as Commnad-Line tool and Go library.\n### Commnad-Line\n\n```sh\nnetselect [options] \u003chost(s)\u003e\n```\n#### Examples\n```sh\n$ netselect google.com google.in google.us\ngoogle.com       55 ms  100% ok         ( 3/ 3)\ngoogle.in        56 ms  100% ok         ( 3/ 3)\ngoogle.us        59 ms  100% ok         ( 3/ 3)\n```\n\nRead the  [documentation](https://pgollangi.github.io/netselect)  for more information on the CLI usage.\n\n### Go Library\n\nHere is a simple example that finds fastest hosts:\n\n```go\nhosts := []*netselect.Host{\n    \u0026netselect.Host{Address: \"google.in\"},\n    \u0026netselect.Host{Address: \"google.com\"},\n}\n\nnetSelector, err :=netselect.NewNetSelector(hosts)\nif err != nil {\n    panic(err)\n}\n\nresults, err := netSelector.Select()\n\nfastestHosts := results // Fastest hosts in ASC order\n```\nRead the  [API documentation](https://pkg.go.dev/github.com/pgollangi/netselect) for more information on the library usage.\n\n## Installation \n\n### Scoop\n```sh\nscoop bucket add pgollangi-bucket https://github.com/pgollangi/scoop-bucket.git\nscoop install netselect\n```\n### Homebrew\n```sh\nbrew install pgollangi/tap/netselect\n```\nUpdating:\n```\nbrew upgrade netselect\n```\n### Go\n```sh\n$ go get github.com/pgollangi/netselect/cmd/netselect\n$ netselect\n```\n\n### Manual\n1. Download and install binary from the [latest release](https://github.com/pgollangi/netselect/releases/latest).\n2. Recommended: add `netselect` executable to your $PATH.\n\n## Building from source\n\n`netselect` CLI is written in the [Go programming language](https://golang.org/), so to build the CLI yourself, you first need to have Go installed and configured on your machine.\n\n ### Install Go\n\nTo download and install  `Go`, please refer to the  [Go documentation](https://golang.org/doc/install). Please download  `Go 1.14.x`  or above.\n\n### Clone this repository\n```sh\n$ git clone https://gitlab.com/pgollangi/netselect.git\n$ cd netselect\n```\n### Build\n\n```sh\n$ go build cmd/netselect/netselect.go\n$ netselect\n\n```\n\n## Notice for linux users\n`netelect` implements ICMP ping using both raw socket and UDP. It needs to be run as a root user.\n\nAlternatley, you can use `setcap` to allow `netselect` to bind to raw sockets\n```sh\nsetcap cap_net_raw=+ep /bin/netselect\n```\nIf you do not wish to do all this, you can use flag `--privileged=false` to send an \"unprivileged\" ping via UDP. This must be enabled by setting\n\n```sh\nsudo sysctl -w net.ipv4.ping_group_range=\"0   2147483647\"\n```\n\nSee [this blog](https://sturmflut.github.io/linux/ubuntu/2015/01/17/unprivileged-icmp-sockets-on-linux/) and the Go [icmp library](https://pkg.go.dev/golang.org/x/net/icmp?tab=doc) for more details.\n\n## Contributing\nThanks for considering contributing to this project!\n\nPlease read the [Contributions](.github/CONTRIBUTING.md) and [Code of conduct](.github/CODE_OF_CONDUCT.md). \n\nFeel free to open an issue or submit a pull request!\n\n## License\n\n[MIT](LICENSE)\n\nCopyright © [Prasanna Kumar](https://pgollangi.github.io/tabs/about)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgollangi%2Fnetselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgollangi%2Fnetselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgollangi%2Fnetselect/lists"}