Skip to content

pgollangi/go-portfinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build codecov Go Report Card Maintainability License: MIT

go-portfinder

Go implementation of npm portfinder. A simple tool to find an open port on the current machine.

Installation

$ go get github.com/pgollangi/go-portfinder

Usage

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