Skip to content

Commit

Permalink
fix dns updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-nettica committed Jun 25, 2024
1 parent 340b75a commit 2185037
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ func CreateVPN(vpn *model.VPN) (*model.VPN, error) {
if device.OS == "darwin" {
vpn.Current.Dns = append(vpn.Current.Dns, "127.0.0.1")
} else {
ipDns, err := util.GetIpFromCidr(vpn.Current.Address[0])
if err != nil {
return nil, err
}
parts := strings.Split(vpn.Current.Address[0], "/")
ipDns := parts[0]
// prepend the first address to the dns list
dns := vpn.Current.Dns
vpn.Current.Dns = []string{ipDns}
Expand Down Expand Up @@ -287,10 +285,8 @@ func UpdateVPN(Id string, vpn *model.VPN, flag bool) (*model.VPN, error) {
// if its not a mac its running on the vpn's ip address
if device.OS != "darwin" {
// Append the first address to the dns list
address, err = util.GetIpFromCidr(vpn.Current.Address[0])
if err != nil {
return nil, err
}
parts := strings.Split(vpn.Current.Address[0], "/")
address = parts[0]
}

found := false
Expand Down

0 comments on commit 2185037

Please sign in to comment.