Skip to content

Commit

Permalink
Added knock response and error message for server secret collisions.
Browse files Browse the repository at this point in the history
  • Loading branch information
EgeBalci committed Apr 14, 2023
1 parent b996627 commit 64c53be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions knock.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const (
KNOCK_FAIL uint = 0xE1
// KNOCK_BUSY is the knock sequence response code indicating busy connection.
KNOCK_BUSY uint = 0xE2
// KNOCK_IN_USE is the knock sequence response code indicating busy connection.
KNOCK_IN_USE uint = 0xE3
)

var (
Expand Down Expand Up @@ -77,6 +79,8 @@ func (qs *QSocket) SendKnockSequence() error {
return ErrSocketBusy
case byte(KNOCK_FAIL):
return ErrConnRefused
case byte(KNOCK_IN_USE):
return ErrAddressInUse
default:
return ErrInvalidKnockResponse
}
Expand Down
3 changes: 2 additions & 1 deletion qsock.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ const (
var (
ErrUntrustedCert = errors.New("certificate fingerprint mismatch")
ErrUninitializedSocket = errors.New("socket not initiated")
ErrQSocketSessionEnd = errors.New("qSocket session has ended")
ErrQSocketSessionEnd = errors.New("QSocket session has ended")
ErrUnexpectedSocket = errors.New("unexpected socket type")
ErrInvalidIdTag = errors.New("invalid peer ID tag")
ErrNoTlsConnection = errors.New("TLS socket is nil")
ErrSocketNotConnected = errors.New("socket is not connected")
ErrSrpFailed = errors.New("SRP auth failed")
ErrSocketInUse = errors.New("socket already dialed")
ErrAddressInUse = errors.New("address already in use")
)

// A QSocket structure contains required values
Expand Down

0 comments on commit 64c53be

Please sign in to comment.