mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-13 16:21:25 +00:00
cleanup code after reviewing code in PR
This commit is contained in:
@@ -75,11 +75,6 @@ type TunIpInfo struct {
|
||||
DNS string
|
||||
}
|
||||
|
||||
type DnsConfig struct {
|
||||
aIpv4 string
|
||||
aIpv6 string
|
||||
}
|
||||
|
||||
func (id *Identity) Path() string {
|
||||
if id.FingerPrint == "" {
|
||||
log.Fatalf("fingerprint is invalid for id %s", id.Name)
|
||||
@@ -96,7 +91,6 @@ type TunnelStatus struct {
|
||||
ServiceVersion ServiceVersion
|
||||
TunIpv4 string
|
||||
TunIpv4Mask int
|
||||
DnsConfig DnsConfig
|
||||
}
|
||||
|
||||
type ServiceVersion struct {
|
||||
|
||||
@@ -235,13 +235,9 @@ func initialize() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
setTunInfo(rts.state)
|
||||
|
||||
//
|
||||
//ready := make(chan bool)
|
||||
//go assignDns(assignedIp, ready)
|
||||
//<-ready
|
||||
// connect any identities that are enabled
|
||||
for _, id := range rts.state.Identities {
|
||||
connectIdentity(id)
|
||||
}
|
||||
@@ -252,31 +248,6 @@ func initialize() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func assignDns(tunIp net.IP, ready chan bool) {
|
||||
log.Info("Assigning dns")
|
||||
|
||||
c1 := make(chan string, 1)
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
c1 <- "result 1"
|
||||
}()
|
||||
select {
|
||||
case res := <-c1:
|
||||
fmt.Println(res)
|
||||
case <-time.After(5 * time.Second):
|
||||
fmt.Println("timeout 5")
|
||||
}
|
||||
cziti.DnsInit(&rts, tunIp.String(), rts.state.TunIpv4Mask)
|
||||
dns := []net.IP{ tunIp }
|
||||
log.Infof("DNS server - launching: %v", dns)
|
||||
go cziti.RunDNSserver(dns, ready)
|
||||
log.Infof("DNS server - waiting for startup")
|
||||
<-ready
|
||||
ready <- true
|
||||
log.Infof("DNS server - ready")
|
||||
cziti.Start()
|
||||
}
|
||||
|
||||
func setTunInfo(s *dto.TunnelStatus) {
|
||||
ipv4 := rts.state.TunIpv4
|
||||
ipv4mask := rts.state.TunIpv4Mask
|
||||
|
||||
@@ -152,17 +152,10 @@ func (t *RuntimeState) CreateTun(ipv4 string, ipv4mask int) (net.IP, error) {
|
||||
|
||||
log.Infof("setting TUN interface address to [%s]", ip)
|
||||
err = luid.SetIPAddresses([]net.IPNet{{ip, ipnet.Mask}})
|
||||
//err = luid.SetIPAddresses([]net.IPNet{{IP:ip, Mask: []byte{255,255,255,0}}})
|
||||
//err = luid.SetIPAddresses([]net.IPNet{{IP:ip, Mask: []byte{255,255,255,255}}})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to set IP address to %v: (%v)", ip, err)
|
||||
}
|
||||
|
||||
//dnsip := net.ParseIP("100.64.0.1")
|
||||
//dnsip := ip //net.ParseIP("127.21.71.53")
|
||||
//ipnet2 := net.IPNet{IP: dnsip, Mask: []byte{255,255,255,255}}
|
||||
//log.Infof("meh: %v", ipnet2)
|
||||
//err = luid.SetIPAddresses([]net.IPNet{ *ipnet })
|
||||
|
||||
dnsServers := []net.IP{ ip }
|
||||
|
||||
log.Infof("adding DNS servers to TUN: %s", dnsServers)
|
||||
|
||||
Reference in New Issue
Block a user