k0001 / network-simple

Haskell library abstracting common network sockets usage patterns.
BSD 3-Clause "New" or "Revised" License
33 stars 9 forks source link

Remove dependency on network-bsd maybe? #34

Closed chris-martin closed 1 year ago

chris-martin commented 3 years ago

I've been trying to update things to use the latest version of the network library, and unfortunately network-bsd still does not support it. (https://github.com/haskell/network-bsd/issues/10) I'm not sure whether network-bsd is still being maintained?

I would be able to sidestep this problem if network-simple could drop its network-bsd dependency. I'm looking at the extent to which this package relies on that one, and it seems that it's a fairly small bit:

https://github.com/k0001/network-simple/blob/678483e7c451b545dabe1a0354c476bdd8ba8de6/src/Network/Simple/Internal.hs#L82-L89

Since a few years have now elapsed since this workaround was added, is it possible that the socks5 library has resolved its issue? I don't quite understand what the issue is or how I'd find out.

k0001 commented 3 years ago

Thank you @chris-martin.

I'm not sure what's going on with the socks-related byte swapping. I'm swapping things inside getServicePortNumber' sometimes, and then in connectSockSOCKS5 again every time. It seems wrong. I'll review and change that.

Regarding the dependency on network-bsd: I suppose we could ditch the dependency if we call the getservbyname C function directly. It would be relatively straightforward. But, seeing as network-bsd is a library depended upon by many popular Haskell packages (https://packdeps.haskellers.com/reverse/network-bsd), maybe it's best to just fix things there.

k0001 commented 3 years ago

This is probably related to the byte swapping issue: https://github.com/haskell/network-bsd/blob/2167eca412fa488f7b2622fcd61af1238153dae7/Network/BSD.hsc#L183

k0001 commented 1 year ago

I don't think this issue is relevant anymore. Closing.