Skip to content

Commit

Permalink
resolve conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jyyi1 committed Dec 4, 2024
1 parent 0831f68 commit 407e2a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
12 changes: 4 additions & 8 deletions client/electron/vpn_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {invokeGoApi} from './go_plugin';
import {invokeMethod} from './go_plugin';
import {
StartRequestJson,
TunnelStatus,
Expand All @@ -38,23 +38,19 @@ export async function establishVpn(request: StartRequestJson) {
id: currentRequestId,
interfaceName: 'outline-tun0',
ipAddress: '10.0.85.5',
dnsServers: ['8.8.4.4'],
dnsServers: ['9.9.9.9'],
routingTableId: 7113,
routingPriority: 28958,
protectionMark: 0x711e,
transport: JSON.stringify(request.config.transport),
};
const connectionJson = await invokeGoApi(
'EstablishVPN',
JSON.stringify(config)
);
console.info(JSON.parse(connectionJson));
await invokeMethod('EstablishVPN', JSON.stringify(config));
statusCb?.(currentRequestId, TunnelStatus.CONNECTED);
}

export async function closeVpn(): Promise<void> {
statusCb?.(currentRequestId!, TunnelStatus.DISCONNECTING);
await invokeGoApi('CloseVPN', '');
await invokeMethod('CloseVPN', '');
statusCb?.(currentRequestId!, TunnelStatus.DISCONNECTED);
}

Expand Down
8 changes: 4 additions & 4 deletions client/go/outline/electron/go_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import (
const (
// EstablishVPNAPI initiates a VPN connection and directs all network traffic through Outline.
//
// - Input: a JSON string of [VPNConfig].
// - Output: a JSON string of [VPNConnection].
// - Input: a JSON string of vpnConfigJSON.
// - Output: a JSON string of vpnConnectionJSON.
EstablishVPNAPI = "EstablishVPN"

// CloseVPNAPI closes an existing VPN connection and restores network traffic to the default
Expand All @@ -71,14 +71,14 @@ func InvokeMethod(method *C.char, input *C.char) C.InvokeMethodResult {
// Electron specific APIs
case EstablishVPNAPI:
res, err := EstablishVPN(C.GoString(input))
return C.InvokeGoAPIResult{
return C.InvokeMethodResult{
Output: newCGoString(res),
ErrorJson: marshalCGoErrorJson(err),
}

case CloseVPNAPI:
err := CloseVPN()
return C.InvokeGoAPIResult{ErrorJson: marshalCGoErrorJson(err)}
return C.InvokeMethodResult{ErrorJson: marshalCGoErrorJson(err)}

// Common APIs
default:
Expand Down

0 comments on commit 407e2a1

Please sign in to comment.