http-party / node-portfinder

A simple tool to find an open port or domain socket on the current machine
https://github.com/http-party/node-portfinder
Other
882 stars 95 forks source link

【feature request】support to use array as basePort #100

Closed lovetingyuan closed 4 years ago

lovetingyuan commented 4 years ago

portfinder.basePort = [4200, 8080]

if 4200 is available, just use 4200, else if 8080 is available, just use 8080, or search other port(like 8081, 8082...)

eriktrom commented 4 years ago

what if they're both taken?

its a legit ask, but refactoring is needed, and thus a new version of this lib would be required as a major bump

although what if they are both taken, and the next 200 ports after each are taken too... (sure feels edge case, but its an algo we'd have to ensure doesn't stray just b/c the base case seems easy)

eriktrom commented 4 years ago

@lovetingyuan - feel free to check my comment on pr #105 which would allow iteration of such an idea. If it gains traction, I will take the idea into further consideration.

Thanks for your feedback.

eriktrom commented 4 years ago

closing to cleanup issue list, comments or questions still welcome, if needed