1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-27 22:30:26 +08:00

init complete

This commit is contained in:
fumiama
2021-10-25 01:01:22 +08:00
parent d9138df3cd
commit e29d5b2f48
9 changed files with 115 additions and 38 deletions

31
gold/link/crypto.go Normal file
View File

@@ -0,0 +1,31 @@
package link
import "net"
var (
privKey [32]byte
me net.IP
myend *net.UDPAddr
)
func SetMyself(privateKey [32]byte, myIP string, myEndpoint string) {
privKey = privateKey
var err error
myend, err = net.ResolveUDPAddr("udp", myEndpoint)
if err != nil {
panic(err)
}
me = net.ParseIP(myIP)
myconn, err = listen()
if err != nil {
panic(err)
}
}
func (l *Link) Encode(b []byte) (eb []byte, err error) {
return b, nil
}
func (l *Link) Decode(b []byte) (db []byte, err error) {
return b, nil
}