IP address of caller
I need to put some security based on the IP address of the client calling an API.
Is there a way I can know the original IP address of the caller from the request?
60 Replies
Project ID:
d1c85c02-8ca5-43c3-adc6-4a24cb066e33
d1c85c02-8ca5-43c3-adc6-4a24cb066e33
Solution
sweet
thx brody
adding this. Ruby Rails headers have HTTP_ prefix before the header
oh damn
good spot
thanks!
theres probably a middleware that would do all this for you
my quick and dirty
that would just return the original string if there is no comma right?
perfect π
yeah ruby is nice like that
super forgiving language
lets you do bad stuff though π
i did not expect that of Go!
why not!? π
you can do that in almost every language
idk, i think some languages crash if you do
[][0]
there's no items in that array
ruby is fine, it says, whatever man, nil
peace
what happens if the string is "" in this Go code?
Off topic but what are you using for these screenshots? They're stunning
Xnapper! But I think a railway member (fp) has made an open source clone
Awesome, thank you :D
Do you by any chance have a link to the open source clone?
@Vin sorry to tag you here, but do you know?
Yeah, the source for FPs project is here https://github.com/FarazPatankar/snip-snap/
GitHub
GitHub - FarazPatankar/snip-snap: A simple but powerful tool to mak...
A simple but powerful tool to make your screenshots prettier. - GitHub - FarazPatankar/snip-snap: A simple but powerful tool to make your screenshots prettier.
it returns a slice with
""
then selecting the zeroth index from that slice will just return an empty string valueGo is extremely forgiving, but the code analyzers and compiler prevent you from doing stupid things
that's really nice π
That's one of the reasons why I have been using Go for literally everything lately... Prevents me from doing the normal stupid things I tend to do
Such good code Brody
in my head that sounds like sarcasm
hehe
Nope. It was sincere... You have seen my code... I still manage to do a lot of bad things with Go
aws shucks, thanks π
tbh if I ever do a re-write, I'de sincerely consider Go again
though now that im looking at it, why didnt i just do this
i think one of the pains i had was GORM kinda sucked
gorm does suck
idk if there's better alterntatives now
there is
oo
Gorm is so good though
that's good
i mean back when I used GORM it didn't even have good migration files
it just auto migrated everything
good times
but yeah now all my slow areas of code are to do with the damn database layer being slow >.<
ActiveRecord is also very bloated
ActiveRecord hurts my soul
oh well, future self problem
>.<
Thank you so much!!
ThePrimeTime
YouTube
Golang Is Poorly Designed | Prime Reacts
Recorded live on twitch, GET IN
https://twitch.tv/ThePrimeagen
Reviewed article: https://medium.com/@paul.folbrecht/golang-is-a-poorly-designed-language-c1361b49e82#:~:text=Even%20the%20smart%20Go%20promoters,make%20specific%20things%20%E2%80%9Ceasier.%E2%80%9D
Author: Paul Folbrecht | https://medium.com/@paul.folbrecht
MY MAIN YT CHANNEL: H...
I don't like him
This episode I think youβll like
I don't think I will
go is perfect
Go watch it (when you have time)
how long is it
25 mins
That's about 24 minutes too long for Brody! π€£
If it isn't Fireship something in 100 seconds, its too long
oh hell no, fireships 100 second videos are already pushing the limits of my attention span
π§
is there a brain emoji that doesn't have wrinkles?
You got the reference π«Άπ€£