mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 07:11:40 +00:00
Use 'curve25519' instead of 'pubkey'
This commit is contained in:
parent
6b0b704645
commit
429189d11d
@ -199,9 +199,9 @@ func (k BoxPubKey) String() string {
|
|||||||
return hex.EncodeToString(k[:])
|
return hex.EncodeToString(k[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network returns "pubkey" for "box" keys.
|
// Network returns "curve25519" for "box" keys.
|
||||||
func (n BoxPubKey) Network() string {
|
func (n BoxPubKey) Network() string {
|
||||||
return "pubkey"
|
return "curve25519"
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBoxKeys generates a new pair of public/private crypto box keys.
|
// NewBoxKeys generates a new pair of public/private crypto box keys.
|
||||||
|
@ -18,21 +18,21 @@ type Dialer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dial opens a session to the given node. The first parameter should be
|
// Dial opens a session to the given node. The first parameter should be
|
||||||
// "pubkey" or "nodeid" and the second parameter should contain a hexadecimal
|
// "curve25519" or "nodeid" and the second parameter should contain a
|
||||||
// representation of the target. It uses DialContext internally.
|
// hexadecimal representation of the target. It uses DialContext internally.
|
||||||
func (d *Dialer) Dial(network, address string) (net.Conn, error) {
|
func (d *Dialer) Dial(network, address string) (net.Conn, error) {
|
||||||
return d.DialContext(nil, network, address)
|
return d.DialContext(nil, network, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialContext is used internally by Dial, and should only be used with a
|
// DialContext is used internally by Dial, and should only be used with a
|
||||||
// context that includes a timeout. It uses DialByNodeIDandMask internally when
|
// context that includes a timeout. It uses DialByNodeIDandMask internally when
|
||||||
// the network is "nodeid", or DialByPublicKey when the network is "pubkey".
|
// the network is "nodeid", or DialByPublicKey when the network is "curve25519".
|
||||||
func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
||||||
var nodeID crypto.NodeID
|
var nodeID crypto.NodeID
|
||||||
var nodeMask crypto.NodeID
|
var nodeMask crypto.NodeID
|
||||||
// Process
|
// Process
|
||||||
switch network {
|
switch network {
|
||||||
case "pubkey":
|
case "curve25519":
|
||||||
dest, err := hex.DecodeString(address)
|
dest, err := hex.DecodeString(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user