freeport v0.1.0
freeport
Get a free and open TCP port that is ready to use. Inspired by FreePort.
Installation
Command Line
Download the executable from the release page or build from source with shards build
.
Library
Add this to your application's shard.yml
:
dependencies:
freeport:
github: petoem/freeport
version: 0.1.0
Usage
Command Line
> freeport -h
Usage: freeport [arguments]
-n, --newline Print port number with a newline
-v, --version Output version information and exit
-h, --help Show this help
Library
require "freeport"
# Returns a free TCP port, may raise an exception if no free ports are available.
FreePort.get
# Returns a free TCP port or `nil`.
FreePort.get?
Limitation
freeport
returns a port available at the moment, a race condition may occur and the port could be taken by the time you try binding to the port yourself.
Contributing
- Fork it!
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Michael Petö - creator and maintainer
Repository
freeport
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- almost 6 years ago
- January 27, 2019
License
MIT License
Links
Synced at
Sun, 24 Nov 2024 04:08:36 GMT
Languages