dudleycarr / nsqjs

NodeJS client library for NSQ
https://nsqjs.com
MIT License
557 stars 76 forks source link

fix: Allow connect to ipv6 addresses #352

Closed oyyd closed 3 years ago

oyyd commented 3 years ago

Thanks for the great lib :)

When a client tries to connect to a nsqd behind an IPv6 address, the client would throw errors like:

Error: lookupdHTTPAddresses must be a list of addresses 'host:port' or HTTP/HTTPS URI

I think it's because passing ipv6 addresses, e.g. [::1]:4150 , to isBareAddress() would make it return false:

https://github.com/dudleycarr/nsqjs/blob/8956c69ad978452ffe9a7fd7c11dd276846aa324/lib/config.js#L38-L41

Feel free to close this PR if there is a better solution.