Skip to content

Commit

Permalink
Merge pull request #724 from mysteriumnetwork/sonatype-backport
Browse files Browse the repository at this point in the history
Disable wireguard for windows
  • Loading branch information
soffokl authored Feb 8, 2019
2 parents 553d733 + 1a18e17 commit 73f9402
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cmd/connections_register.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !android
// +build !android,!windows

/*
* Copyright (C) 2018 The "MysteriumNetwork/node" Authors.
Expand Down
29 changes: 29 additions & 0 deletions cmd/connections_register_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// +build windows

/*
* Copyright (C) 2019 The "MysteriumNetwork/node" Authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package cmd

import (
"github.com/mysteriumnetwork/node/core/node"
)

func (di *Dependencies) registerConnections(nodeOptions node.Options) {
di.registerOpenvpnConnection(nodeOptions)
di.registerNoopConnection()
}
21 changes: 0 additions & 21 deletions cmd/service_bootstrap_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,11 @@ import (
service_noop "github.com/mysteriumnetwork/node/services/noop"
service_openvpn "github.com/mysteriumnetwork/node/services/openvpn"
openvpn_service "github.com/mysteriumnetwork/node/services/openvpn/service"
"github.com/mysteriumnetwork/node/services/wireguard"
wireguard_service "github.com/mysteriumnetwork/node/services/wireguard/service"
"github.com/mysteriumnetwork/node/session"
)

const logPrefix = "[service bootstrap] "

// BootstrapServices loads all the components required for running services
func (di *Dependencies) BootstrapServices(nodeOptions node.Options) error {
di.bootstrapServiceComponents(nodeOptions)

di.bootstrapServiceOpenvpn(nodeOptions)
di.bootstrapServiceNoop(nodeOptions)
di.bootstrapServiceWireguard(nodeOptions)

return nil
}

func (di *Dependencies) bootstrapServiceOpenvpn(nodeOptions node.Options) {
createService := func(serviceOptions service.Options) (service.Service, error) {
transportOptions := serviceOptions.Options.(openvpn_service.Options)
Expand All @@ -71,14 +58,6 @@ func (di *Dependencies) bootstrapServiceNoop(nodeOptions node.Options) {
di.ServiceRunner.Register(service_noop.ServiceType)
}

func (di *Dependencies) bootstrapServiceWireguard(nodeOptions node.Options) {
di.ServiceRegistry.Register(wireguard.ServiceType, func(serviceOptions service.Options) (service.Service, error) {
return wireguard_service.NewManager(di.LocationResolver, di.IPResolver, di.NATService), nil
})

di.ServiceRunner.Register(wireguard.ServiceType)
}

// bootstrapServiceComponents initiates ServiceManager dependency
func (di *Dependencies) bootstrapServiceComponents(nodeOptions node.Options) {
identityHandler := identity_selector.NewHandler(
Expand Down
46 changes: 46 additions & 0 deletions cmd/service_bootstrap_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// +build darwin linux,!android

/*
* Copyright (C) 2019 The "MysteriumNetwork/node" Authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package cmd

import (
"github.com/mysteriumnetwork/node/core/node"
"github.com/mysteriumnetwork/node/core/service"
"github.com/mysteriumnetwork/node/services/wireguard"
wireguard_service "github.com/mysteriumnetwork/node/services/wireguard/service"
)

// BootstrapServices loads all the components required for running services
func (di *Dependencies) BootstrapServices(nodeOptions node.Options) error {
di.bootstrapServiceComponents(nodeOptions)

di.bootstrapServiceOpenvpn(nodeOptions)
di.bootstrapServiceNoop(nodeOptions)
di.bootstrapServiceWireguard(nodeOptions)

return nil
}

func (di *Dependencies) bootstrapServiceWireguard(nodeOptions node.Options) {
di.ServiceRegistry.Register(wireguard.ServiceType, func(serviceOptions service.Options) (service.Service, error) {
return wireguard_service.NewManager(di.LocationResolver, di.IPResolver, di.NATService), nil
})

di.ServiceRunner.Register(wireguard.ServiceType)
}
34 changes: 34 additions & 0 deletions cmd/service_bootstrap_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// +build windows

/*
* Copyright (C) 2019 The "MysteriumNetwork/node" Authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package cmd

import (
"github.com/mysteriumnetwork/node/core/node"
)

// BootstrapServices loads all the components required for running services
func (di *Dependencies) BootstrapServices(nodeOptions node.Options) error {
di.bootstrapServiceComponents(nodeOptions)

di.bootstrapServiceOpenvpn(nodeOptions)
di.bootstrapServiceNoop(nodeOptions)

return nil
}

0 comments on commit 73f9402

Please sign in to comment.