1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-07-01 08:10:22 +08:00

perf: remove tea encryption

This commit is contained in:
源文雨
2024-07-11 22:31:44 +09:00
parent c0bd86d1bb
commit e115098344
14 changed files with 243 additions and 117 deletions

View File

@@ -4,11 +4,11 @@ import (
"crypto/cipher"
"errors"
"net"
"sync/atomic"
"github.com/fumiama/WireGold/gold/head"
"github.com/fumiama/WireGold/helper"
base14 "github.com/fumiama/go-base16384"
tea "github.com/fumiama/gofastTEA"
)
// Link 是本机到 peer 的连接抽象
@@ -27,10 +27,8 @@ type Link struct {
endpoint *net.UDPAddr
// 本机允许接收/发送的 ip 网段
allowedips []*net.IPNet
// 连接所用对称加密密钥
key []tea.TEA
// 连接所用预共享密钥
aead cipher.AEAD
// 连接所用对称加密密钥
keys [32]cipher.AEAD
// 本机信息
me *Me
// 连接的状态,详见下方 const
@@ -84,3 +82,7 @@ func (l *Link) String() (n string) {
}
return
}
func (l *Link) incgetsndcnt() uintptr {
return atomic.AddUintptr(&l.sendcount, 1)
}