mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 22:55:06 +03:00
Try to perform TCP-like key exchange
This commit is contained in:
parent
704e4a062f
commit
f556f3e2a8
2 changed files with 32 additions and 48 deletions
|
@ -13,11 +13,9 @@ void Log(const char *text) {
|
|||
*/
|
||||
import "C"
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"unsafe"
|
||||
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/util"
|
||||
)
|
||||
|
||||
|
@ -31,26 +29,11 @@ func (nsl MobileLogger) Write(p []byte) (n int, err error) {
|
|||
return len(p), nil
|
||||
}
|
||||
|
||||
func (c *Core) AWDLCreateInterface(boxPubKey string, sigPubKey string, name string) error {
|
||||
func (c *Core) AWDLCreateInterface(name string) error {
|
||||
fromAWDL := make(chan []byte, 32)
|
||||
toAWDL := make(chan []byte, 32)
|
||||
|
||||
var boxPub crypto.BoxPubKey
|
||||
var sigPub crypto.SigPubKey
|
||||
boxPubHex, err := hex.DecodeString(boxPubKey)
|
||||
if err != nil {
|
||||
c.log.Println(err)
|
||||
return err
|
||||
}
|
||||
sigPubHex, err := hex.DecodeString(sigPubKey)
|
||||
if err != nil {
|
||||
c.log.Println(err)
|
||||
return err
|
||||
}
|
||||
copy(boxPub[:], boxPubHex)
|
||||
copy(sigPub[:], sigPubHex)
|
||||
|
||||
if intf, err := c.awdl.create(fromAWDL, toAWDL, &boxPub, &sigPub, name); err == nil {
|
||||
if intf, err := c.awdl.create(fromAWDL, toAWDL, name); err == nil {
|
||||
if intf != nil {
|
||||
c.log.Println(err)
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue