Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jyyi1 committed Jan 31, 2025
1 parent 64bd661 commit 75d5a45
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions client/go/outline/method_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const (

// EstablishVPN initiates a VPN connection and directs all network traffic through Outline.
//
// - Input: A callback token string.
// - Output: null
MethodSetVPNStateChangeListener = "SetVPNStateChangeListener"
// - Input: a JSON string of vpn.configJSON.
// - Output: a JSON string of vpn.connectionJSON.
MethodEstablishVPN = "EstablishVPN"

// FetchResource fetches a resource located at a given URL.
// - Input: the URL string of the resource to fetch
Expand All @@ -44,6 +44,16 @@ const (
// - Input: the transport config text
// - Output: the TunnelConfigJson that Typescript needs
MethodParseTunnelConfig = "ParseTunnelConfig"

// SetVPNStateChangeListener sets a callback to be invoked when the VPN state changes.
//
// We recommend the caller to set this listener at app startup to catch all VPN state changes.
// Users might start the VPN from system settings, bypassing the app;
// so setting the listener when connecting within the app might miss some events.
//
// - Input: A callback token string.
// - Output: null
MethodSetVPNStateChangeListener = "SetVPNStateChangeListener"
)

// InvokeMethodResult represents the result of an InvokeMethod call.
Expand Down Expand Up @@ -80,6 +90,12 @@ func InvokeMethod(method string, input string) *InvokeMethodResult {
case MethodParseTunnelConfig:
return doParseTunnelConfig(input)

case MethodSetVPNStateChangeListener:
err := setVPNStateChangeListener(input)
return &InvokeMethodResult{
Error: platerrors.ToPlatformError(err),
}

default:
return &InvokeMethodResult{Error: &platerrors.PlatformError{
Code: platerrors.InternalError,
Expand Down

0 comments on commit 75d5a45

Please sign in to comment.