Skip to content

Commit

Permalink
Print remote hint in PSK examples
Browse files Browse the repository at this point in the history
Print the hint to stdout, just so the user understands
the purpose of the passed value.

Resolves #45
  • Loading branch information
Sean-Der committed Jul 1, 2019
1 parent 6646228 commit 0a9c0ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/dial-psk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ func main() {
// Prepare the configuration of the DTLS connection
config := &dtls.Config{
PSK: func(hint []byte) ([]byte, error) {
fmt.Printf("Server's hint: %s \n", hint)
return []byte{0xAB, 0xC1, 0x23}, nil
},
PSKIdentityHint: []byte("Pion DTLS"),
PSKIdentityHint: []byte("Pion DTLS Server"),
CipherSuites: []dtls.CipherSuiteID{dtls.TLS_PSK_WITH_AES_128_CCM8},
}

Expand Down
3 changes: 2 additions & 1 deletion examples/listen-psk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ func main() {
// Prepare the configuration of the DTLS connection
config := &dtls.Config{
PSK: func(hint []byte) ([]byte, error) {
fmt.Printf("Client's hint: %s \n", hint)
return []byte{0xAB, 0xC1, 0x23}, nil
},
PSKIdentityHint: []byte("Pion DTLS"),
PSKIdentityHint: []byte("Pion DTLS Client"),
CipherSuites: []dtls.CipherSuiteID{dtls.TLS_PSK_WITH_AES_128_CCM8},
}

Expand Down

0 comments on commit 0a9c0ce

Please sign in to comment.