mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-10 08:41:20 +08:00
ext clients fix
This commit is contained in:
parent
015bd5d366
commit
df41675f74
3 changed files with 10 additions and 8 deletions
|
|
@ -88,8 +88,6 @@ var RelayPeerMap = make(map[string]map[string]RemotePeer)
|
||||||
|
|
||||||
var ExtClientsWaitTh = make(map[string][]context.CancelFunc)
|
var ExtClientsWaitTh = make(map[string][]context.CancelFunc)
|
||||||
|
|
||||||
var PeerAddrMap = make(map[string]map[string]*Conn)
|
|
||||||
|
|
||||||
// RunCmd - runs a local command
|
// RunCmd - runs a local command
|
||||||
func RunCmd(command string, printerr bool) (string, error) {
|
func RunCmd(command string, printerr bool) (string, error) {
|
||||||
args := strings.Fields(command)
|
args := strings.Fields(command)
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,12 @@ func (m *ManagerAction) processPayload() (*wg.WGIface, error) {
|
||||||
for i := len(m.Payload.Peers) - 1; i >= 0; i-- {
|
for i := len(m.Payload.Peers) - 1; i >= 0; i-- {
|
||||||
|
|
||||||
if currentPeer, ok := wgProxyConf.PeerMap[m.Payload.Peers[i].PublicKey.String()]; ok {
|
if currentPeer, ok := wgProxyConf.PeerMap[m.Payload.Peers[i].PublicKey.String()]; ok {
|
||||||
|
|
||||||
|
// handles ext clients
|
||||||
|
if common.IsIngressGateway && m.Payload.PeerMap[m.Payload.Peers[i].PublicKey.String()].IsAttachedExtClient {
|
||||||
|
// check if sniffer already exists otherwise start one
|
||||||
|
continue
|
||||||
|
}
|
||||||
// check if proxy is off for the peer
|
// check if proxy is off for the peer
|
||||||
if !m.Payload.PeerMap[m.Payload.Peers[i].PublicKey.String()].Proxy {
|
if !m.Payload.PeerMap[m.Payload.Peers[i].PublicKey.String()].Proxy {
|
||||||
|
|
||||||
|
|
@ -290,6 +296,7 @@ func (m *ManagerAction) processPayload() (*wg.WGIface, error) {
|
||||||
m.Payload.Peers = append(m.Payload.Peers[:i], m.Payload.Peers[i+1:]...)
|
m.Payload.Peers = append(m.Payload.Peers[:i], m.Payload.Peers[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// sync peer map with new update
|
||||||
for _, currPeerI := range wgProxyConf.PeerMap {
|
for _, currPeerI := range wgProxyConf.PeerMap {
|
||||||
if _, ok := m.Payload.PeerMap[currPeerI.Config.Key]; !ok {
|
if _, ok := m.Payload.PeerMap[currPeerI.Config.Key]; !ok {
|
||||||
currPeerI.Proxy.Cancel()
|
currPeerI.Proxy.Cancel()
|
||||||
|
|
@ -303,6 +310,9 @@ func (m *ManagerAction) processPayload() (*wg.WGIface, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sync dev peers with new update
|
||||||
|
|
||||||
common.WgIFaceMap[m.Payload.InterfaceName] = wgProxyConf
|
common.WgIFaceMap[m.Payload.InterfaceName] = wgProxyConf
|
||||||
|
|
||||||
// if peers, ok := common.WgIFaceMap[iface]; ok {
|
// if peers, ok := common.WgIFaceMap[iface]; ok {
|
||||||
|
|
|
||||||
|
|
@ -118,12 +118,6 @@ func AddNewPeer(wgInterface *wg.WGIface, peer *wgtypes.PeerConfig, peerAddr stri
|
||||||
common.WgIFaceMap[wgInterface.Name] = ifaceConf
|
common.WgIFaceMap[wgInterface.Name] = ifaceConf
|
||||||
common.WgIFaceMap[wgInterface.Name].PeerMap[peer.PublicKey.String()] = &peerConn
|
common.WgIFaceMap[wgInterface.Name].PeerMap[peer.PublicKey.String()] = &peerConn
|
||||||
}
|
}
|
||||||
if _, ok := common.PeerAddrMap[wgInterface.Name]; ok {
|
|
||||||
common.PeerAddrMap[wgInterface.Name][peerAddr] = &peerConn
|
|
||||||
} else {
|
|
||||||
common.PeerAddrMap[wgInterface.Name] = make(map[string]*common.Conn)
|
|
||||||
common.PeerAddrMap[wgInterface.Name][peerAddr] = &peerConn
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue