Skip to content

Commit

Permalink
return specific errors; update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ingon committed Jan 19, 2025
1 parent 5fcd050 commit b1bd7b7
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 34 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,13 @@ by adding account management and it is one of the easiest way to start.
- [x] Stateless reset key for the server
- [x] Name access restrictions for clients
- [x] File http server
- [ ] Use quic-go tracer, instead of ping (and duration estimation)
- [x] Use quic-go tracer, instead of ping (and duration estimation)
- [ ] error wrapping

## Future

- [ ] UDP support
- [ ] Optimize global IP restrictions - check earlier
- [ ] Gen config
- [ ] proxy proto support
- [ ] http source
2 changes: 1 addition & 1 deletion client/peer_direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func (p *directPeerOutgoing) connect(ctx context.Context) (quic.Connection, erro
}

if err := p.check(ctx, conn); err != nil {
// TODO conn close?
conn.CloseWithError(quic.ApplicationErrorCode(pb.Error_CheckFailed), "connection check failed")
errs = append(errs, err)
continue
}
Expand Down
4 changes: 2 additions & 2 deletions client/peer_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (r *relayPeer) connect(ctx context.Context) (quic.Connection, error) {
}

if err := r.check(ctx, conn); err != nil {
// TODO conn close?
conn.CloseWithError(quic.ApplicationErrorCode(pb.Error_CheckFailed), "connection check failed")
return nil, err
}
return conn, nil
Expand All @@ -123,7 +123,7 @@ func (r *relayPeer) check(ctx context.Context, conn quic.Connection) error {
}

func (r *relayPeer) keepalive(ctx context.Context, conn quic.Connection) error {
defer conn.CloseWithError(quic.ApplicationErrorCode(pb.Error_DirectKeepaliveClosed), "keepalive closed") // TODO relay?
defer conn.CloseWithError(quic.ApplicationErrorCode(pb.Error_RelayKeepaliveClosed), "keepalive closed")

r.local.addRelayConn(r.serverHostport, conn)
defer r.local.removeRelayConn(r.serverHostport)
Expand Down
69 changes: 39 additions & 30 deletions pb/shared.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pb/shared.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ message Error {
// Generic
Unknown = 0;
RequestUnknown = 1;
CheckFailed = 2;

// Authentication
AuthenticationFailed = 100;
Expand All @@ -49,6 +50,7 @@ message Error {
// Relay
RelayValidationFailed = 300;
RelayInvalidCertificate = 301;
RelayKeepaliveClosed = 302;

// Direct
DirectConnectionClosed = 400;
Expand Down

0 comments on commit b1bd7b7

Please sign in to comment.