mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-14 00:29:48 +00:00
Merge pull request #171 from openziti/release-1.2.13-tweaks
Release 1.2.13 tweaks
This commit is contained in:
+15
-1
@@ -1,4 +1,18 @@
|
||||
@echo off
|
||||
REM Copyright NetFoundry, Inc.
|
||||
REM
|
||||
REM Licensed under the Apache License, Version 2.0 (the "License");
|
||||
REM you may not use this file except in compliance with the License.
|
||||
REM You may obtain a copy of the License at
|
||||
REM
|
||||
REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
REM
|
||||
REM Unless required by applicable law or agreed to in writing, software
|
||||
REM distributed under the License is distributed on an "AS IS" BASIS,
|
||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
REM See the License for the specific language governing permissions and
|
||||
REM limitations under the License.
|
||||
REM
|
||||
|
||||
set CURDIR=%CD%
|
||||
set SVC_ROOT_DIR=%~dp0
|
||||
@@ -41,7 +55,7 @@ cd %SVC_ROOT_DIR%
|
||||
SET REPO_URL=https://github.com/openziti/ziti-tunneler-sdk-c.git
|
||||
SET ZITI_TUNNEL_REPO_BRANCH=v0.6.11
|
||||
SET TUNNELER_SDK_DIR=%SVC_ROOT_DIR%deps\ziti-tunneler-sdk-c\
|
||||
SET CGO_CFLAGS=-DNOGDI -O3 -g3 -I %TUNNELER_SDK_DIR%install\include
|
||||
SET CGO_CFLAGS=-DNOGDI -I %TUNNELER_SDK_DIR%install\include
|
||||
SET CGO_LDFLAGS=-L %TUNNELER_SDK_DIR%install\lib
|
||||
|
||||
if exist %SVC_ROOT_DIR%ziti.dll (
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright NetFoundry, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package cziti
|
||||
|
||||
var cbuff = make([][]byte, MaxDnsRequests)
|
||||
|
||||
@@ -183,7 +183,9 @@ func runListener(ip *net.IP, port int, reqch chan dnsreq) {
|
||||
log.Panicf("An unexpected and unrecoverable error has occurred while %s: %v", "reading a udp message", err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(reqch) == cap(reqch) {
|
||||
log.Warn("DNS req will be blocked. If this warning is continuously displayed please report")
|
||||
}
|
||||
reqch <- dnsreq{
|
||||
q: b[:nb],
|
||||
s: server,
|
||||
@@ -203,6 +205,9 @@ type proxiedReq struct {
|
||||
}
|
||||
|
||||
func proxyDNS(req *dns.Msg, peer *net.UDPAddr, serv *net.UDPConn, ipVer int) {
|
||||
if len(proxiedRequests) == cap(proxiedRequests) {
|
||||
log.Warn("proxiedRequests will be blocked. If this warning is continuously displayed please report")
|
||||
}
|
||||
proxiedRequests <- &proxiedReq{
|
||||
req: req,
|
||||
peer: peer,
|
||||
@@ -224,10 +229,9 @@ func dnsPanicRecover(localDnsServers []net.IP) {
|
||||
}
|
||||
|
||||
func runDNSproxy(upstreamDnsServers []string, localDnsServers []net.IP) {
|
||||
log.Infof("restarting DNS proxy")
|
||||
log.Infof("starting DNS proxy upstream: %v, local: %v", upstreamDnsServers, localDnsServers)
|
||||
domains = GetConnectionSpecificDomains()
|
||||
log.Infof("ConnectionSpecificDomains: %v", domains)
|
||||
log.Infof("dnsServers: %v", upstreamDnsServers)
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Errorf("Recovering from panic due to DNS-related issue. %v", err)
|
||||
@@ -279,6 +283,9 @@ func runDNSproxy(upstreamDnsServers []string, localDnsServers []net.IP) {
|
||||
log.Warnf("odd error: %v", err)
|
||||
}
|
||||
} else {
|
||||
if len(respChan) == cap(respChan) {
|
||||
log.Warn("respChan will be blocked. If this warning is continuously displayed please report")
|
||||
}
|
||||
respChan <- resp[:n]
|
||||
}
|
||||
}
|
||||
|
||||
+16
-14
@@ -110,7 +110,7 @@ func ReplaceDNS(ips []net.IP) {
|
||||
}
|
||||
ipsAsString := strings.Join(ipsStrArr, ",")
|
||||
|
||||
log.Infof("Injecting DNS servers [%s] onto interfaces", ipsAsString)
|
||||
log.Infof("injecting DNS servers [%s] onto interfaces", ipsAsString)
|
||||
|
||||
script := fmt.Sprintf(`$dnsinfo=Get-DnsClientServerAddress
|
||||
$dnsIps=@(%s)
|
||||
@@ -119,31 +119,33 @@ $dnsIps=@(%s)
|
||||
$IPv4=2
|
||||
$IPv6=23
|
||||
|
||||
$dnsPerInterface = @{}
|
||||
$dnsUpdates = @{}
|
||||
|
||||
foreach ($dns in $dnsinfo)
|
||||
{
|
||||
if($dnsPerInterface[$dns.InterfaceIndex] -eq $null) {
|
||||
$dnsPerInterface[$dns.InterfaceIndex]=[System.Collections.ArrayList]@()
|
||||
} else {
|
||||
if($dnsUpdates[$dns.InterfaceIndex] -eq $null) { $dnsUpdates[$dns.InterfaceIndex]=[System.Collections.ArrayList]@() }
|
||||
if($dns.AddressFamily -eq $IPv6) {
|
||||
$dnsServers=$dns.ServerAddresses
|
||||
$ArrList=[System.Collections.ArrayList]@($dnsServers)
|
||||
foreach ($dnsIp in $dnsIps)
|
||||
{
|
||||
if(($dnsServers -ne $null) -and ($ArrList.Contains($dnsIp)) ) {
|
||||
# uncomment when debugging echo ($dns.InterfaceAlias + " IPv4 already contains ${dnsIp}")
|
||||
$dnsUpdates[$dns.InterfaceIndex].AddRange($ArrList)
|
||||
}
|
||||
elseif($dns.AddressFamily -eq $IPv4){
|
||||
$dnsServers=$dns.ServerAddresses
|
||||
$ArrList=[System.Collections.ArrayList]@($dnsServers)
|
||||
foreach($d in $dnsIps) {
|
||||
if(($dnsServers -ne $null) -and ($dnsServers.Contains($d)) ) {
|
||||
# uncomment when debugging echo ($dns.InterfaceAlias + " IPv4 already contains 127.0.0.1")
|
||||
} else {
|
||||
$ArrList.Insert(0, $dnsIp)
|
||||
$ArrList.Insert(0,$d)
|
||||
}
|
||||
}
|
||||
$dnsPerInterface[$dns.InterfaceIndex].AddRange($ArrList)
|
||||
$dnsUpdates[$dns.InterfaceIndex].AddRange($ArrList)
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($key in $dnsPerInterface.Keys)
|
||||
foreach ($key in $dnsUpdates.Keys)
|
||||
{
|
||||
$dnsServers=$dnsPerInterface[$key]
|
||||
Set-DnsClientServerAddress -InterfaceIndex $key -ServerAddresses ($dnsServers)
|
||||
Set-DnsClientServerAddress -InterfaceIndex $key -ServerAddresses ($dnsUpdates[$key])
|
||||
}`, ipsAsString)
|
||||
|
||||
cmd := exec.Command("powershell", "-Command", script)
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
@echo off
|
||||
REM Copyright NetFoundry, Inc.
|
||||
REM
|
||||
REM Licensed under the Apache License, Version 2.0 (the "License");
|
||||
REM you may not use this file except in compliance with the License.
|
||||
REM You may obtain a copy of the License at
|
||||
REM
|
||||
REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
REM
|
||||
REM Unless required by applicable law or agreed to in writing, software
|
||||
REM distributed under the License is distributed on an "AS IS" BASIS,
|
||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
REM See the License for the specific language governing permissions and
|
||||
REM limitations under the License.
|
||||
REM
|
||||
|
||||
set CURDIR=%CD%
|
||||
set SVC_ROOT_DIR=%~dp0
|
||||
|
||||
Binary file not shown.
@@ -1 +1,16 @@
|
||||
@echo off
|
||||
REM Copyright NetFoundry, Inc.
|
||||
REM
|
||||
REM Licensed under the Apache License, Version 2.0 (the "License");
|
||||
REM you may not use this file except in compliance with the License.
|
||||
REM You may obtain a copy of the License at
|
||||
REM
|
||||
REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
REM
|
||||
REM Unless required by applicable law or agreed to in writing, software
|
||||
REM distributed under the License is distributed on an "AS IS" BASIS,
|
||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
REM See the License for the specific language governing permissions and
|
||||
REM limitations under the License.
|
||||
REM
|
||||
call build quick
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
get-netipinterface | ForEach-Object { Set-DnsClientServerAddress -InterfaceIndex $_.ifIndex -ResetServerAddresses}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Copyright NetFoundry, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
get-netipinterface | ForEach-Object { Set-DnsClientServerAddress -InterfaceIndex $_.ifIndex -ResetServerAddresses}
|
||||
+18
-3
@@ -1,4 +1,19 @@
|
||||
set SVC_ROOT_DIR=%~dp0
|
||||
SET TUNNELER_SDK_DIR=%SVC_ROOT_DIR%deps\ziti-tunneler-sdk-c\
|
||||
SET CGO_CFLAGS=-DNOGDI -I %TUNNELER_SDK_DIR%install\include
|
||||
@echo off
|
||||
REM Copyright NetFoundry, Inc.
|
||||
REM
|
||||
REM Licensed under the Apache License, Version 2.0 (the "License");
|
||||
REM you may not use this file except in compliance with the License.
|
||||
REM You may obtain a copy of the License at
|
||||
REM
|
||||
REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
REM
|
||||
REM Unless required by applicable law or agreed to in writing, software
|
||||
REM distributed under the License is distributed on an "AS IS" BASIS,
|
||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
REM See the License for the specific language governing permissions and
|
||||
REM limitations under the License.
|
||||
REM
|
||||
set SVC_ROOT_DIR=%~dp0
|
||||
SET TUNNELER_SDK_DIR=%SVC_ROOT_DIR%deps\ziti-tunneler-sdk-c\
|
||||
SET CGO_CFLAGS=-DNOGDI -I %TUNNELER_SDK_DIR%install\include
|
||||
SET CGO_LDFLAGS=-L %TUNNELER_SDK_DIR%install\lib
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright NetFoundry, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright NetFoundry, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package constants
|
||||
|
||||
const(
|
||||
@@ -5,6 +22,4 @@ const(
|
||||
Ipv4MaxMask = 8
|
||||
Ipv4MinMask = 28
|
||||
Ipv4DefaultMask = 24
|
||||
|
||||
DnsIpv4Default = "127.0.0.1"
|
||||
)
|
||||
@@ -155,7 +155,7 @@ func (t *RuntimeState) CreateTun(ipv4 string, ipv4mask int) (net.IP, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to set IP address to %v: (%v)", ip, err)
|
||||
}
|
||||
|
||||
|
||||
dnsServers := []net.IP{ ip }
|
||||
|
||||
log.Infof("adding DNS servers to TUN: %s", dnsServers)
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright NetFoundry, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user