Skip to content

Konstantin8105/FreePort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FreePort

Coverage Status Build Status Go Report Card GitHub license GoDoc

Return a free tcp port.

Minimal example of using:

func main(){
	port, err := freeport.Get()
	if err != nil {
		panic(err)
	}
	if 0 < port && port < 65536 {
		fmt.Println("Found free tcp port")
	}
}

or:

func main() {
	port, err := freeport.Get()
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
	fmt.Print(port)
}

About

Return a free tcp port

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages