mscdex / socksv5

SOCKS protocol version 5 server and client implementations for node.js
MIT License
400 stars 121 forks source link

server: add `localAddress` fallback for node v0.8 #7

Closed TooTallNate closed 9 years ago

TooTallNate commented 9 years ago

I'm not sure if this is 100% the correct way to fix this, but it does make basic usage scripts work now, whereas before they'd fail with:

/Users/nrajlich/node_modules/socksv5/lib/server.js:217
                  len = localbytes.length,
                                  ^
TypeError: Cannot read property 'length' of undefined
    at Socket.dns.lookup.socket.dstSock (/Users/nrajlich/node_modules/socksv5/lib/server.js:217:35)
    at Socket.EventEmitter.emit (events.js:93:17)
    at Object.afterConnect [as oncomplete] (net.js:752:10)

(I know that v0.8 is getting pretty old at this point, but I try to keep compatibility when it's a one-line fix like this)

:beers:

mscdex commented 9 years ago

Landed in 4577d30a72935c. Thanks!