tinygo-org / net

Port of Go's "net" package to work with TinyGo on embedded processors.
https://tinygo.org
BSD 2-Clause "Simplified" License
15 stars 8 forks source link

Add ResolveIPAddr and ResolveUnixAddr #23

Open paralin opened 3 months ago

paralin commented 3 months ago

https://github.com/tinygo-org/net/blob/a79417481d37e21f29d257c28fecc503df9703e0/udpsock.go#L84

I see that ResolveTCPAddr is in, could ResolveIPAddr and ResolveUnixAddr be added?

scottfeldman commented 3 months ago

ResolveIPAddr looks doable. You want to try a crack at implementing? It should be vary similar to ResolveUDPAddr.

We don't have unix socket support in tinygo "net" package, so I would say No.

scottfeldman commented 3 months ago

Are you wanting to use these funcs for real networking, or just to compile? If just for compile, we could add stubs that return "not implemented". That would make the compiler happy.

paralin commented 3 months ago

I think just the stubs are fine for now!

scottfeldman commented 3 months ago

Oh, that's easy then. Would you submit a PR to add those stubs?

paralin commented 3 months ago

Sure, on it

paralin commented 3 months ago

@scottfeldman here is ResolveIPAddr which actually works for some IP addresses, just not those that require accessing /etc/protocols: https://github.com/tinygo-org/net/pull/24

paralin commented 3 months ago

@scottfeldman Here is ResolveUnixAddr: https://github.com/tinygo-org/net/pull/25