mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-13 13:40:30 +08:00
fix: mtu
This commit is contained in:
@@ -28,7 +28,7 @@ func (m *Me) AddPeer(cfg *PeerConfig) (l *Link) {
|
|||||||
if ok {
|
if ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if cfg.MTU == 0 || cfg.MTU == 65535 || cfg.MTU > m.mtu {
|
if cfg.MTU == 0 || cfg.MTU == 65535 || (m.mtu != 0 && cfg.MTU > m.mtu) {
|
||||||
panic("invalid mtu for peer " + cfg.PeerIP)
|
panic("invalid mtu for peer " + cfg.PeerIP)
|
||||||
}
|
}
|
||||||
l = &Link{
|
l = &Link{
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ func (wg *WG) init(srcport, dstport uint16) {
|
|||||||
MyIPwithMask: wg.c.IP + "/32",
|
MyIPwithMask: wg.c.IP + "/32",
|
||||||
MyEndpoint: wg.c.EndPoint,
|
MyEndpoint: wg.c.EndPoint,
|
||||||
PrivateKey: &wg.key,
|
PrivateKey: &wg.key,
|
||||||
NIC: lower.NewNIC(wg.c.IP, wg.c.SubNet, strconv.FormatInt(wg.c.MTU, 64), cidrs...),
|
NIC: lower.NewNIC(wg.c.IP, wg.c.SubNet, strconv.FormatInt(wg.c.MTU, 10), cidrs...),
|
||||||
SrcPort: srcport,
|
SrcPort: srcport,
|
||||||
DstPort: dstport,
|
DstPort: dstport,
|
||||||
MTU: uint16(wg.c.MTU),
|
MTU: uint16(wg.c.MTU),
|
||||||
|
|||||||
Reference in New Issue
Block a user