Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Oct 8, 2022
1 parent 6f8be90 commit b6f65d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions internal/helpers_turn.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func xor(content, key []byte) []byte {

// xorAddr implements the XOR required for the STUN and TURN protocol
//
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |x x x x x x x x| Family | X-Port |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | X-Address (Variable)
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |x x x x x x x x| Family | X-Port |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | X-Address (Variable)
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Figure 6: Format of XOR-MAPPED-ADDRESS Attribute
func xorAddr(ip netip.Addr, port uint16, transactionID []byte) ([]byte, error) {
Expand Down Expand Up @@ -104,9 +104,9 @@ func ConvertXORAddr(input []byte, transactionID string) (string, uint16, error)

// SetupTurnConnection executes the following:
//
// Allocate Unauth (to get realm and nonce)
// Allocate Auth
// CreatePermission
// Allocate Unauth (to get realm and nonce)
// Allocate Auth
// CreatePermission
//
// it returns the connection, the realm, the nonce and an error
func SetupTurnConnection(logger DebugLogger, connectProtocol string, turnServer string, useTLS bool, timeout time.Duration, targetHost netip.Addr, targetPort uint16, username, password string) (net.Conn, string, string, error) {
Expand Down
10 changes: 5 additions & 5 deletions internal/helpers_turntcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

// SetupTurnTCPConnection executes the following:
//
// Allocate Unauth (to get realm and nonce)
// Allocate Auth
// Connect
// Opens Data Connection
// ConnectionBind
// Allocate Unauth (to get realm and nonce)
// Allocate Auth
// Connect
// Opens Data Connection
// ConnectionBind
//
// it returns the controlConnection, the dataConnection and an error
func SetupTurnTCPConnection(logger DebugLogger, turnServer string, useTLS bool, timeout time.Duration, targetHost netip.Addr, targetPort uint16, username, password string) (*net.TCPConn, *net.TCPConn, error) {
Expand Down

0 comments on commit b6f65d2

Please sign in to comment.