-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed to use progress write wrapper
- Loading branch information
1 parent
1654be1
commit 2fcd76c
Showing
5 changed files
with
52 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,30 @@ | ||
- Have the hole puncher time out and return a helpful error after a given amount of time. | ||
- Have the hole puncher prefer local sockets over public sockets. | ||
# To-Do's | ||
Items to consider implementing. Not all of them are desirable or necessary. | ||
These are just some quick notes that might not make sense. | ||
|
||
- Have the hole puncher actively prefer local sockets over public sockets. | ||
But I don't think this matters much since | ||
most NATs don't support hairpin translation, and if they do, I doubt its much slower than a direct connection. | ||
|
||
- Deduplicate errors in the error vec the hole puncher can return. | ||
This might give a more helpful error message to the user. | ||
|
||
- Give the client and server the option to use plain TCP instead of TLS. | ||
This might be difficult because various inner functions require a get address function. | ||
Maybe I can create a trait that allows for such a function call, and implement this trait | ||
for both raw TCP and TLS? That sounds overly complicated, but maybe it's the only option? | ||
Or potentially just pass an address parameter everywhere?? | ||
|
||
- Can the hole puncher even be used standalone from contact exchange? Yeah, I suppose | ||
if someone is trying to reconnect or something. | ||
- Restructure the hole puncher to force keeping connection to server open | ||
during hole-punching. That might please some NATs that lose state when TCP connection is closed. | ||
|
||
- Make peer authentication not "block" hole punching. | ||
|
||
- Potentially keep connection to server open during hole punching? | ||
|
||
"Blocking" might be an issue when the peer is receiving other | ||
incoming connections. But this probably won't happen unless | ||
the peer's device is acting as some sort of server. | ||
|
||
- Improve error message everywhere in general. Have helpful tips to the user. | ||
- Add checks in the file transfer to avoid TOCTOU bugs. | ||
- Change the progress bar to use indicatif's built-in wrap write. | ||
|
||
# Hole punching idea | ||
|
||
Ok, here's my genius new idea: | ||
|
||
the `get_contact(..., time_limit)` function will try and: | ||
|
||
- If a local <-> local connection is authenticated, return early. | ||
- Otherwise, keep trying until the `time_limit` is reached. | ||
- If success, return that TCP connection and corresponding secret key. | ||
- Otherwise, return a struct that gives detailed information about the attempts. | ||
|
||
## The error struct | ||
|
||
This struct will have a field for each attempted connection (v4 private and public, v6 private and public), | ||
as well as a field for the v4 listener and the v6 listener. | ||
- Add checks in the file transfer to avoid TOCTOU bugs. | ||
|
||
Each of these will store an enum of: | ||
- Didn't try connecting from here because no v4 or v6 was used. | ||
- IO Error | ||
- Established TCP connection, but didn't receive any messages on it. | ||
- Established TCP connection, but received invalid messages. | ||
- Established TCP connection, but the peer's shared secret was incorrect. | ||
- Change the progress bar to use indicatif's built-in wrap write. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters