5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-20 04:52:33 +00:00

remove old tcp key exchange code

This commit is contained in:
Arceliar 2018-06-09 17:49:02 -05:00
parent 8733099516
commit 076350f963

View File

@ -354,30 +354,8 @@ func (iface *tcpInterface) reader(sock net.Conn, in func([]byte)) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Magic bytes to check // Magic bytes to check
var tcp_key = [...]byte{'k', 'e', 'y', 's'}
var tcp_msg = [...]byte{0xde, 0xad, 0xb1, 0x75} // "dead bits" var tcp_msg = [...]byte{0xde, 0xad, 0xb1, 0x75} // "dead bits"
func tcp_chop_keys(box *boxPubKey, sig *sigPubKey, link *boxPubKey, bs *[]byte) bool {
// This one is pretty simple: we know how long the message should be
// So don't call this with a message that's too short
if len(*bs) < len(tcp_key)+2*len(*box)+len(*sig) {
return false
}
for idx := range tcp_key {
if (*bs)[idx] != tcp_key[idx] {
return false
}
}
(*bs) = (*bs)[len(tcp_key):]
copy(box[:], *bs)
(*bs) = (*bs)[len(box):]
copy(sig[:], *bs)
(*bs) = (*bs)[len(sig):]
copy(link[:], *bs)
(*bs) = (*bs)[len(sig):]
return true
}
func tcp_chop_msg(bs *[]byte) ([]byte, bool, error) { func tcp_chop_msg(bs *[]byte) ([]byte, bool, error) {
// Returns msg, ok, err // Returns msg, ok, err
if len(*bs) < len(tcp_msg) { if len(*bs) < len(tcp_msg) {