Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2019-06-24 00:00:00Z and 2019-06-25 00:00:00Z
Avatar
@snail
Avatar
@archimede67 ty
Avatar
np ^^
Avatar
@snail if i randomly tag you do i also get a thank you?
Avatar
a1b5d9e More accurate donation info for RUS - def-
💲 2
Avatar
@n000b i guess that's a no 😂
Avatar
ChillerDragon 2019-06-24 11:59:37Z
thank you
15:15
except ryozuki
Avatar
ChillerDragon 2019-06-24 15:24:52Z
mean
Avatar
@heinrich5991 I remember you talking about a spec for the http masters somewhere, is that correct?
Avatar
@Learath2 not really, don't remember
Avatar
Well does using a PATCH as a heartbeat sound reasonable to you?
Avatar
I'd use a POST
16:02
patch sounds more obscure
16:03
@Learath2 make sure to include proper IPv6 support for these masters
Avatar
I was thinking POST to list a server, then something like a PATCH with the current timestamp as a heartbeat
Avatar
Why not trying instead of thinking? 😂
Avatar
Because I'd rather do it right once then trying 50 different variations
Avatar
@Learath2 I'd just send a POST request every time, no difference between the first and later ones
16:29
(like currently)
Avatar
But you will not be sure until you do it
Avatar
@archimede67 APIs like these I prefer designing first, then implementing according to a spec
Avatar
Which spec?
Avatar
the one we think of
Avatar
@heinrich5991 is that really efficient though, if we keep the packets smaller the server would be more equipped to handle attacks
16:30
@archimede67 the spec I prefer to design, as stated in the first half of the sentence 😛
16:34
Also do you think we should keep it just ip:port? We could have the masters store more
Avatar
I think we should store more
16:34
I liked this sample register request:
16:35
{ "info": { "clients": [ { "name": "heinrich5991", "clan": "", "country": null, "score": 123, "team": -1 } ], "max_players": 64, "max_clients": 64, "passworded": false, "game_type": "DDRaceNetwork", "name": "DDNet RUS - Moderate [DDraceNetwork]", "map": { "name": "Sunreal", "crc": "0abcdef1", "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "size": 12345 }, "version": "0.6.4, 11.2.1" }, "port": 1234, "secret": "abcdef" }
16:35
i.e. complete info that the masterserver can distribute
Avatar
Yeah I had something similar in mind
16:36
The only difference I had in mind was to have the future messages be a PATCH
Avatar
don't overthink that, we can add that later
Avatar
with the secret and a timestamp
Avatar
better get a working version first IMO
16:36
oh yea, a version is still missing
16:36
from that json
16:36
(so that lingering old requests don't override newer ones)
Avatar
a timestamp or a counter should be fine for that
Avatar
yea, counter I'd think
Avatar
a unix timestamp would be better as we can use that to expire entries aswell
16:39
Also I'm thinking of implementing the masterserver in python, any objections to that? 😛
Avatar
no, can reimplement it in rust later
16:40
(if the need arises)
Avatar
yeah, was also thinking rust later if we need the performance
Avatar
we can't trust the client either way, so timestamp doesn't help there
16:40
(use flask!)
Avatar
yeah already using flask
Avatar
and write the server list to a static file to be served by a real http server
16:41
ok, so one complete https request with little payload data has 2.5kb of data, with data say 4kb
16:42
or let's say 3kb with data
16:42
1000 servers doing this, 3kb each, every 15 seconds (as we currently do), I get 200kb/s
Avatar
that's quite managable
Avatar
which seems fine (also, it should be less because we re-use https connections, so the 2.5kb overhead per connection should go away, yielding <50kb/s) (edited)
Avatar
I had one more concern in mind, do you think we should account for horizontal scaling?
16:44
(i doubt we'd ever need it given we'd put this behind some run of the mill ddos protection service anyways)
16:45
e.g. should we support multiple masters?
Avatar
I'd say no to horizontal scaling
16:45
I'd like multiple masters
Avatar
"The HTTP PATCH request method applies partial modifications to a resource." i think it has nothing to do with a heartbeat
Avatar
each server registers at each master, clients request one
Avatar
why not just a GET request?
Avatar
@Ryozuki it'd be modifying the "timestamp" in the server entry
Avatar
because it modifies state, and that would be against the HTTP spec
Avatar
POST for registering
Avatar
GETs are supposed to never modify state
Avatar
what means heartbeat?
Avatar
the server says it's still alive
Avatar
updting the info?
Avatar
a message to show that the server is still alive
Avatar
only alive?
16:46
hmm
Avatar
well would also modify the data in this case
Avatar
still i dont think patch fits
16:47
you want to make the master server be like a rest api?
Avatar
yes
Avatar
thats a cool idea
Avatar
anyway, what do you think about my multiple masters proposal, @Learath2 ?
16:47
I think matricks originally proposed it ^^
Avatar
I don't really see a problem with it, the increase of traffic for the server is negligible to register at all masters
16:48
I think we shouldn't hardcode the masters this time
16:48
maybe a request to /masters to get a list of all the masters
Avatar
"The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times." does sending a heartbeat has diferent effects over time?
Avatar
meh, not sure I like that @Learath2
16:49
but I'd definitely like a masters.cfg, one url per line where the master servers are
Avatar
its better heinrich way
16:49
that way u dont rely on one point
16:49
which can be ddosed
Avatar
what I was proposing is a way to get that masters.cfg
Avatar
if you can't reach the master, you just use your old masters.cfg
Avatar
yea, I think self-update ought to be enough
Avatar
I don't know
16:50
what use-case do you have in mind, @Learath2 ?
Avatar
e.g. we add a new master
Avatar
but where whould u implement master servers? at ddnet level or at teeworlds 0.6?
16:50
will u make it backwards compatible?
Avatar
it's unreasonable to expect users that can't figure out how to change their names to add a new master
Avatar
yes. that'd be done with the update
16:51
like the updated client
Avatar
oh, that's true, maybe letting the update handle it is a better idea
16:51
hmm, it's not quite as real-time
Avatar
we specify https://master1.ddnet.tw/ to https://master4.ddnet.tw/ and that gives us some room to spare
Avatar
also yeah, how general should I keep this?
16:52
also maybe some versioning
Avatar
it would be cool if the master server can also provide custom endpoints for data such as total players, total amount of servers and amount of servers per gamemode etc
16:52
but thats secondary i guess
Avatar
@Ryozuki yeah, I was thinking of that aswell
Avatar
that way u make it someone who wants to interact weith masters not make so many calls
16:53
or whathever
Avatar
@Learath2 yea, add a version to the top of the path
Avatar
@heinrich5991 do we really need to output to a static file?
Avatar
@Learath2 what lang will u use for the rest sv
Avatar
I think we should do that. serving from database is a bad idea IMO
Avatar
@Ryozuki flask python for now
Avatar
hmm serving from database with a cache is better IMO
Avatar
update it once per second or so
Avatar
yeah we could configure nginx to cache a little
Avatar
@Learath2 i think PUT fits heartbeat
16:56
@Learath2 no u would use memcached or smth like that, i would rely more in the server directly managing the cache than nginx
Avatar
or I could output to a static file, and we could do some nginx configuration black magic to only serve one endpoint as a file and the rest goes to flask
Avatar
but thats just me
Avatar
@Learath2 that's not particularly hard to configure
16:57
so that'd be fine
16:57
I think
Avatar
memcached also sounds like a decent idea, I'll just get a draft implementation for now
16:58
we can think about caching after I get the thing working
Avatar
managing the cache urself directly allows u to renew it when u get a updated resource btw
16:58
nginx cant know much
Avatar
yeah, it does sound more reasonable that we should be managing the cache if we don't write out to a static file
16:59
but with a static file we can just update that
Avatar
idk about flask, i would personally use nodejs but i know u hate js xd
Avatar
i'm not sure whether nginx is optimized enough to cache a non-changed file
Avatar
im making quite a big rest api lately :p
17:00
idk how nginx cache works
Avatar
what are you using? express.js?
Avatar
the framework i use uses it yes
17:00
NestJS is a framework for building efficient, scalable Node.js web applications. It uses modern JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Avatar
I was thinking node at the beginning, but I didn't want to introduce a new language to ddnet and didn't want the bloat of npm and all that stuff
Avatar
(with typescript)
17:01
@Learath2 its easy to implement cache and ratelimiting with it
17:01
btw u will also want rate limiting
Avatar
I'll let nginx handle the rate-limiting
Avatar
well yeah, but u wont be able to implement rate limiting per endpoint
Avatar
nginx has zones for rate limiting
17:03
does this rest api need some auth
Avatar
i think they are called location blocks instead of zones tho 😛
17:03
no need for auth
Avatar
well if u need help ill be glad to help
17:04
:p
17:04
i used flask time ago too
Avatar
I have a feeling you'd use JWTs 😛
Avatar
im using jwt
17:04
xd
Avatar
yeah, knew it, you are the kind to use the fancy new stuff 😛
Avatar
i love it
17:04
monkaS
Avatar
I usually just go for good old tokens with a key value store
Avatar
¯\_(ツ)_/¯
17:06
im also using a ORM but i end up making lot of raw sql calls cuz it just cant cover my complexity sadly
Avatar
ORMs are good if you are doing bog standard stuff
Avatar
JWTs are good if you have multiple backends that use the same auth, great for microservice architectures
17:08
as a session token though, not really useful, bloated, and creates a potential security issue
Avatar
sql pepeH
Avatar
@archimede67 arent u a web dev
Avatar
making your own social network? 😄
Avatar
@Learath2 kinda
17:09
something weeb
Avatar
ye sql worst thing ever
Avatar
sql is nice
Avatar
no
Avatar
that's a pretty weak ORM if it cant do those, what is it?
Avatar
nosql better
Avatar
@Learath2 well i probs cant do it
17:10
but i cant bother waste 1 hour
17:10
to find out how
17:10
xd
17:11
i mainly relly on the orm to have easy objects and it creates me all the tables and relation tables
17:11
i probs can do it*
Avatar
also migrations, if you have those
17:11
makes it a breeze to extend your schema
Avatar
not yet since i dont have prod yet
17:12
yeah it has migration support
Avatar
wait
17:14
@Learath2 hates js? xd
Avatar
he hates new stuff
17:14
and systemd
Avatar
xd
17:15
oof
17:15
Avatar
it doesnt exist
Avatar
hm
Avatar
well it does but its a domain that probs points to ddnet.tw
17:15
and its not added to the cert
Avatar
ye
Avatar
I like typescript better then js
Avatar
i only code in typescript @Learath2
Avatar
ChillerDragon 2019-06-24 18:43:16Z
oh bois unicode
18:43
how to get rid of ^M ? -.-
18:43
18:43
i tried dos2unix.exe and unix2dos.exe nothing worked
18:43
delteting the line rewriting it
18:44
if i edit the file it messes it up
18:45
even vim from git bash messes it up
Avatar
this isn't unicode btw, likely plain ascii 😛
18:51
which file @ChillerDragon
Avatar
ChillerDragon 2019-06-24 18:52:07Z
stats.h
18:52
vanilla master
18:52
18:52
any idea? I dont want to switch to linux and redo my changes -.-
Avatar
@ChillerDragon it's probably fine
18:57
the file has windows file endings for some weird reason
Avatar
ChillerDragon 2019-06-24 18:57:42Z
but then unix2dos.exe shoudl do the thin..
18:57
ah
18:57
then i get changes in all linex
Avatar
hum?
Avatar
ChillerDragon 2019-06-24 18:58:12Z
maybe i have to edit it with notepad editor from windows? troll
Avatar
send me the file in the small-diff version
19:02
[sent via PM]
19:02
@ChillerDragon file looks good, just commit it like that I guess
Avatar
ChillerDragon 2019-06-24 19:02:47Z
:c
19:02
looks messed up
19:03
if my git gets triggered github git will show this as well
Avatar
nah
19:03
not necessarily
19:03
I actually think I never saw these on github
Avatar
ChillerDragon 2019-06-24 19:04:47Z
grr
19:05
i want to atleast fix the #endif but git reset --hard path doesnt work
19:05
how to only reset one file?
19:09
are yo kidding me i have the bug on linux as well
19:10
what is wrong with this file
Avatar
flag.cpp also has wrong endings
Avatar
it's probably not a bug
19:10
it's just that the file has windows line endings
19:10
git probably only shows these ^M on changed lines
19:11
^M is \r
Avatar
ChillerDragon 2019-06-24 19:11:44Z
it triggers me
Avatar
it's not shown on github
19:12
make a separate PR updating the windows line endings to unix ones
Avatar
ChillerDragon 2019-06-24 19:12:05Z
justatest
19:12
ya was thinking about that
Avatar
git converts them to unix endings usually
19:18
iirc
Avatar
ChillerDragon 2019-06-24 19:30:12Z
i think thats something you can choose on windows git installation
19:30
(YEs i UsE wiNdoWs justatest )
Avatar
Cellegen | HU 2019-06-24 19:30:39Z
windows is good
Avatar
ChillerDragon 2019-06-24 19:30:45Z
u
Avatar
Cellegen | HU 2019-06-24 19:30:48Z
ikr
19:30
no kek emoji
Avatar
windows is bad
20:03
monkaS
Avatar
do you have your autocrlf properly set?
Avatar
ChillerDragon 2019-06-24 21:00:14Z
what ever that is pr is published and github didnt show it
21:00
also tested on linux so i blame the file not my setup
21:00
tested 4 editors and 2 operating systems
Avatar
blaming the file lmao
23:10
yes, the file is broken
23:10
better yet, it has a grudge against you
Avatar
[quakenet] Learath2 BOT 2019-06-24 23:51:08Z
Ryozuki: did you watch the new episode of aot?
Exported 274 message(s)