https://github.com/pgollangi/go-portfinder
Go implementation of npm portfinder
https://github.com/pgollangi/go-portfinder
golang port portfinder
Last synced: 8 months ago
JSON representation
Go implementation of npm portfinder
- Host: GitHub
- URL: https://github.com/pgollangi/go-portfinder
- Owner: pgollangi
- License: mit
- Created: 2021-04-12T14:29:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-10T17:25:24.000Z (almost 3 years ago)
- Last Synced: 2025-01-06T01:11:45.582Z (10 months ago)
- Topics: golang, port, portfinder
- Language: Go
- Homepage: https://github.com/pgollangi/go-portfinder
- Size: 19.5 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/pgollangi/go-portfinder/actions/workflows/build.yml)
[](https://codecov.io/gh/pgollangi/go-portfinder)
[](https://goreportcard.com/report/github.com/pgollangi/go-portfinder)
[](https://codeclimate.com/github/pgollangi/go-portfinder/maintainability)

# go-portfinder
Go implementation of npm [portfinder](https://www.npmjs.com/package/portfinder). A simple tool to find an open port on the current machine.
Installation
--------------
```bash
$ go get github.com/pgollangi/go-portfinder
```
# Usage
```go
package main
import (
"github.com/pgollangi/go-portfinder"
)
func main(){
// scans and returns first open port on all network interfaces of current machine.
openPort, err := portfinder.GetPort(PortFinderOptions {
StartPort: 9090,
StopPort: 9099
})
// Check if a port is open
isOpen, err := portfinder.IsOpen(8080)
}
```
## Author
Built with ❤ by [Prasanna Kumar](https://pgollangi.github.io/tabs/about/)