mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-05 07:50:24 +08:00
feat(config): add inner routing mark y
This commit is contained in:
@@ -47,7 +47,7 @@ Peers:
|
|||||||
PublicKey: 徯萃嵾爻燸攗窍褃冔蒔犡緇袿屿組待族砇嘀
|
PublicKey: 徯萃嵾爻燸攗窍褃冔蒔犡緇袿屿組待族砇嘀
|
||||||
PresharedKey: 瀸敀爅崾嘊嵜紼樴稍毯攣矐訷蟷扛嬋庩崛昀
|
PresharedKey: 瀸敀爅崾嘊嵜紼樴稍毯攣矐訷蟷扛嬋庩崛昀
|
||||||
EndPoint: 1.2.3.4:56789
|
EndPoint: 1.2.3.4:56789
|
||||||
AllowedIPs: ["192.168.233.2/32", "x192.168.233.3/32"] # allow trans to 192.168.233.3, but don not create route
|
AllowedIPs: ["192.168.233.2/32", "x192.168.233.3/32"] # accept packets from 192.168.233.3, but don not create route
|
||||||
KeepAliveSeconds: 0
|
KeepAliveSeconds: 0
|
||||||
QueryList: ["192.168.233.3"]
|
QueryList: ["192.168.233.3"]
|
||||||
MTU: 1400
|
MTU: 1400
|
||||||
@@ -60,8 +60,9 @@ Peers:
|
|||||||
PublicKey: 牢喨粷詸衭譛浾蘹櫠砙杹蟫瑳叩刋橋経挵蘀
|
PublicKey: 牢喨粷詸衭譛浾蘹櫠砙杹蟫瑳叩刋橋経挵蘀
|
||||||
PresharedKey: 竅琚喫従痸告烈兇厕趭萨假蔛瀇譄施烸蝫瘀
|
PresharedKey: 竅琚喫従痸告烈兇厕趭萨假蔛瀇譄施烸蝫瘀
|
||||||
EndPoint: ""
|
EndPoint: ""
|
||||||
AllowedIPs: ["192.168.233.3/32"]
|
AllowedIPs: ["192.168.233.3/32", "y192.168.66.1/32"] # add route to 192.168.66.1 into inner route table but do not add it to system one
|
||||||
MTU: 752
|
MTU: 752
|
||||||
|
DoublePacket: true
|
||||||
KeepAliveSeconds: 0
|
KeepAliveSeconds: 0
|
||||||
AllowTrans: false
|
AllowTrans: false
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ func (m *Me) AddPeer(cfg *PeerConfig) (l *Link) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
noroute := ipnet[0] == 'x'
|
noroute := ipnet[0] == 'x'
|
||||||
if noroute {
|
innerroute := ipnet[0] == 'y'
|
||||||
|
if noroute || innerroute {
|
||||||
ipnet = ipnet[1:]
|
ipnet = ipnet[1:]
|
||||||
if len(ipnet) == 0 {
|
if len(ipnet) == 0 {
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ func (wg *WG) init(srcport, dstport uint16) {
|
|||||||
}
|
}
|
||||||
for _, p := range wg.c.Peers {
|
for _, p := range wg.c.Peers {
|
||||||
for _, ip := range p.AllowedIPs {
|
for _, ip := range p.AllowedIPs {
|
||||||
if len(ip) == 0 || ip[0] == 'x' {
|
if len(ip) == 0 || ip[0] == 'x' || ip[0] == 'y' {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ipnet, _, err := net.ParseCIDR(ip)
|
ipnet, _, err := net.ParseCIDR(ip)
|
||||||
|
|||||||
Reference in New Issue
Block a user