Skip to content

Commit

Permalink
Fix: Empty connections for NordVPN and Windscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jan 31, 2021
1 parent 3c7dc9b commit 180b6c2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
3 changes: 0 additions & 3 deletions internal/firewall/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ func (c *configurator) acceptEstablishedRelatedTraffic(ctx context.Context, remo

func (c *configurator) acceptOutputTrafficToVPN(ctx context.Context,
defaultInterface string, connection models.OpenVPNConnection, remove bool) error {
if connection.IP == nil {
panic("PLEASE CREATE AN ISSUE with this log: https://github.com/qdm12/gluetun/issues")
}
return c.runIptablesInstruction(ctx,
fmt.Sprintf("%s OUTPUT -d %s -o %s -p %s -m %s --dport %d -j ACCEPT",
appendOrDelete(remove), connection.IP, defaultInterface, connection.Protocol, connection.Protocol, connection.Port))
Expand Down
3 changes: 0 additions & 3 deletions internal/openvpn/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ func (l *looper) Run(ctx context.Context, wg *sync.WaitGroup) {
l.cancel()
return
}
if connection.IP == nil {
panic("PLEASE CREATE AN ISSUE with this log: https://github.com/qdm12/gluetun/issues")
}
lines := providerConf.BuildConf(connection, l.username, settings)

if err := writeOpenvpnConf(lines, l.openFile); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/nordvpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ func (n *nordvpn) GetOpenVPNConnection(selection models.ServerSelection) (

connections := make([]models.OpenVPNConnection, len(servers))
for i := range servers {
connection := models.OpenVPNConnection{IP: servers[i].IP, Port: port, Protocol: selection.Protocol}
connections = append(connections, connection)
connections[i] = models.OpenVPNConnection{IP: servers[i].IP, Port: port, Protocol: selection.Protocol}
}

return pickRandomConnection(connections, n.randSource), nil
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/windscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func (w *windscribe) GetOpenVPNConnection(selection models.ServerSelection) (con
}

connections := make([]models.OpenVPNConnection, len(servers))
for _, server := range servers {
connections = append(connections, models.OpenVPNConnection{IP: server.IP, Port: port, Protocol: selection.Protocol})
for i := range servers {
connections[i] = models.OpenVPNConnection{IP: servers[i].IP, Port: port, Protocol: selection.Protocol}
}

return pickRandomConnection(connections, w.randSource), nil
Expand Down

0 comments on commit 180b6c2

Please sign in to comment.