Skip to content

Commit

Permalink
stun: minimal working client/server (#545)
Browse files Browse the repository at this point in the history
WIP branch (on top on ted/ping; will be merged there). Uses
urbit/urbit#6836 for the %arvo side.

- [x] Send/Receive STUN request/response, handled in %arvo by stopping
the %ping app.
- [x] Check DNS resolution -- currently we send STUNs in fakeship mode
  - (check changing hosts.txt)
- [ ] refactor _stun_czar, _ames_czar, 
- make a generic _dns_czar(imp_y) that gets called every ~m5 for our
sponsoring galaxy, and every time an %ames packet is sent to another
galaxy
- [x] refactor _ames_czar/stun_gone 
- [x] Use XOR-MAPPED-ADDRESS to send the sponsee's IP
- [x] Better STUN (re)sends, regarding timers (e.g. number of tries per
attempt... etc)
  - "send requests at times 0 ms, 500 ms, 1500 ms, 3500 ms, 7500
   ms, 15500 ms, and 31500 ms.  If the client has not received a
response after 39500 ms", stop, inject %fail, (re)resolve DNS, and
restart STUN.
- [x] Callback error handling
  - if a response failes, ignore—sender will try again
  - if a request fails, resend it
  - if the DNS resolution fails, stop everyting and restart
- if the response doesn't arrive in ~s39, inject %fail, stop everything
and restart
- [ ] DNS Error handling
  - [x] Failure to resolve DNS (first time) -- have a global ~s25 timer?
- [x] Change in sponsor's IP -- resolve DNS on failure to hear a
response?
  - [x] ~~exponentially backoff~~resolve DNS every 5 minutes
- [x] Better STUN response check
- [x] Add sponsee's IP to MAPPED-ADDRESS attribute field
- [x] cache ip address
- [x] (re)enable %ping app after failure to hear STUN response, if we
eventually hear one
- [ ] Test plan: see last point in
urbit/urbit#6836 (comment)
  • Loading branch information
pkova authored Dec 6, 2023
2 parents e216586 + c343fc8 commit 4a88bd9
Show file tree
Hide file tree
Showing 2 changed files with 705 additions and 51 deletions.
2 changes: 2 additions & 0 deletions pkg/c3/motes.h
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@
# define c3__sard c3_s4('s','a','r','d')
# define c3__sav c3_s3('s','a','v')
# define c3__save c3_s4('s','a','v','e')
# define c3__saxo c3_s4('s','a','x','o')
# define c3__scam c3_s4('s','c','a','m')
# define c3__scan c3_s4('s','c','a','n')
# define c3__scry c3_s4('s','c','r','y')
Expand Down Expand Up @@ -1111,6 +1112,7 @@
# define c3__ston c3_s4('s','t','o','n')
# define c3__stop c3_s4('s','t','o','p')
# define c3__stub c3_s4('s','t','u','b')
# define c3__stun c3_s4('s','t','u','n')
# define c3__stur c3_s4('s','t','u','r')
# define c3__sub c3_s3('s','u','b')
# define c3__sunt c3_s4('s','u','n','t')
Expand Down
Loading

0 comments on commit 4a88bd9

Please sign in to comment.