mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 16:30:27 +00:00
Fix bad check
This commit is contained in:
parent
2a2ad76479
commit
f70b2ebcea
@ -103,7 +103,7 @@ func (l *link) call(uri string, sintf string) error {
|
|||||||
if pubkeys, ok := u.Query()["curve25519"]; ok && len(pubkeys) > 0 {
|
if pubkeys, ok := u.Query()["curve25519"]; ok && len(pubkeys) > 0 {
|
||||||
tcpOpts.pinnedCurve25519Keys = make(map[crypto.BoxPubKey]struct{})
|
tcpOpts.pinnedCurve25519Keys = make(map[crypto.BoxPubKey]struct{})
|
||||||
for _, pubkey := range pubkeys {
|
for _, pubkey := range pubkeys {
|
||||||
if boxPub, err := hex.DecodeString(pubkey); err != nil {
|
if boxPub, err := hex.DecodeString(pubkey); err == nil {
|
||||||
var boxPubKey crypto.BoxPubKey
|
var boxPubKey crypto.BoxPubKey
|
||||||
copy(boxPubKey[:], boxPub)
|
copy(boxPubKey[:], boxPub)
|
||||||
tcpOpts.pinnedCurve25519Keys[boxPubKey] = struct{}{}
|
tcpOpts.pinnedCurve25519Keys[boxPubKey] = struct{}{}
|
||||||
@ -113,7 +113,7 @@ func (l *link) call(uri string, sintf string) error {
|
|||||||
if pubkeys, ok := u.Query()["ed25519"]; ok && len(pubkeys) > 0 {
|
if pubkeys, ok := u.Query()["ed25519"]; ok && len(pubkeys) > 0 {
|
||||||
tcpOpts.pinnedEd25519Keys = make(map[crypto.SigPubKey]struct{})
|
tcpOpts.pinnedEd25519Keys = make(map[crypto.SigPubKey]struct{})
|
||||||
for _, pubkey := range pubkeys {
|
for _, pubkey := range pubkeys {
|
||||||
if sigPub, err := hex.DecodeString(pubkey); err != nil {
|
if sigPub, err := hex.DecodeString(pubkey); err == nil {
|
||||||
var sigPubKey crypto.SigPubKey
|
var sigPubKey crypto.SigPubKey
|
||||||
copy(sigPubKey[:], sigPub)
|
copy(sigPubKey[:], sigPub)
|
||||||
tcpOpts.pinnedEd25519Keys[sigPubKey] = struct{}{}
|
tcpOpts.pinnedEd25519Keys[sigPubKey] = struct{}{}
|
||||||
|
Loading…
Reference in New Issue
Block a user