#Equivalent of Node's "req.socket"?

1 messages · Page 1 of 1 (latest)

strong gale
#

Looking exactly for the equivalent of "req.socket.remoteAddress" but any way that I could be able to get the client's IP without going for headers works.

stiff copper
#

This is on @crystal mirage's todo list to add a server.requestIp(request)

#

I'll add an issue for tracking it

strong gale
strong gale
#

@stiff copper

#

Now it is orphan Hahahahahahahah

stiff copper
#

we have some code for this but haven't turned it into a PR yet

strong gale
crystal mirage
#

yeah someone else worked on it and almost got it finished but its like a couple inches away

#

and then some extra code to glue it to req.socket

strong gale
crystal mirage
#

the way node:http is done in bun is it uses Bun.serve

strong gale
crystal mirage
#

it reimplements the node:http's createServer using Bun.serve
that is how it works right now

strong gale
#

Oh, I mean, the req.socket thing

crystal mirage
#

idk right now but
i think the server is stored somehow with the request

strong gale
#

It seems pretty straightforward I think, surely Zig must have some socket address/port attribute, then it is just going to be surfaced/accessed by Bun's