Skip to content

chore: revert network isolation UI #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public App()

services.AddSingleton<IDispatcherQueueManager>(_ => this);
services.AddSingleton<IDefaultNotificationHandler>(_ => this);
services.AddSingleton<ISettingsManager<CoderConnectSettings>, SettingsManager<CoderConnectSettings>>();
services.AddSingleton<ICredentialBackend>(_ =>
new WindowsCredentialBackend(WindowsCredentialBackend.CoderCredentialsTargetName));
services.AddSingleton<ICredentialManager, CredentialManager>();
Expand Down Expand Up @@ -121,6 +120,7 @@ public App()
// FileSyncListMainPage is created by FileSyncListWindow.
services.AddTransient<FileSyncListWindow>();

services.AddSingleton<ISettingsManager<CoderConnectSettings>, SettingsManager<CoderConnectSettings>>();
services.AddSingleton<IStartupManager, StartupManager>();
// SettingsWindow views and view models
services.AddTransient<SettingsViewModel>();
Expand Down
13 changes: 2 additions & 11 deletions App/Models/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ public class CoderConnectSettings : ISettings<CoderConnectSettings>
/// </summary>
public bool ConnectOnLaunch { get; set; }

/// <summary>
/// When this is true Coder Connect will not attempt to protect against Tailscale loopback issues.
/// </summary>
public bool EnableCorporateVpnSupport { get; set; }

/// <summary>
/// CoderConnect current settings version. Increment this when the settings schema changes.
/// In future iterations we will be able to handle migrations when the user has
Expand All @@ -51,21 +46,17 @@ public CoderConnectSettings()
Version = VERSION;

ConnectOnLaunch = false;

EnableCorporateVpnSupport = false;
}

public CoderConnectSettings(int? version, bool connectOnLaunch, bool enableCorporateVpnSupport)
public CoderConnectSettings(int? version, bool connectOnLaunch)
{
Version = version ?? VERSION;

ConnectOnLaunch = connectOnLaunch;

EnableCorporateVpnSupport = enableCorporateVpnSupport;
}

public CoderConnectSettings Clone()
{
return new CoderConnectSettings(Version, ConnectOnLaunch, EnableCorporateVpnSupport);
return new CoderConnectSettings(Version, ConnectOnLaunch);
}
}
6 changes: 1 addition & 5 deletions App/Services/RpcController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ public interface IRpcController : IAsyncDisposable
public class RpcController : IRpcController
{
private readonly ICredentialManager _credentialManager;
private readonly ISettingsManager<CoderConnectSettings> _settingsManager;

private readonly RaiiSemaphoreSlim _operationLock = new(1, 1);
private Speaker<ClientMessage, ServiceMessage>? _speaker;

private readonly RaiiSemaphoreSlim _stateLock = new(1, 1);
private readonly RpcModel _state = new();

public RpcController(ICredentialManager credentialManager, ISettingsManager<CoderConnectSettings> settingsManager)
public RpcController(ICredentialManager credentialManager)
{
_credentialManager = credentialManager;
_settingsManager = settingsManager;
}

public event EventHandler<RpcModel>? StateChanged;
Expand Down Expand Up @@ -158,7 +156,6 @@ public async Task StartVpn(CancellationToken ct = default)
using var _ = await AcquireOperationLockNowAsync();
AssertRpcConnected();

var coderConnectSettings = await _settingsManager.Read(ct);
var credentials = _credentialManager.GetCachedCredentials();
if (credentials.State != CredentialState.Valid)
throw new RpcOperationException(
Expand All @@ -178,7 +175,6 @@ public async Task StartVpn(CancellationToken ct = default)
{
CoderUrl = credentials.CoderUrl?.ToString(),
ApiToken = credentials.ApiToken,
TunnelUseSoftNetIsolation = coderConnectSettings.EnableCorporateVpnSupport,
},
}, ct);
}
Expand Down
21 changes: 1 addition & 20 deletions App/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public partial class SettingsViewModel : ObservableObject
[ObservableProperty]
public partial bool ConnectOnLaunch { get; set; }

[ObservableProperty]
public partial bool DisableTailscaleLoopProtection { get; set; }

[ObservableProperty]
public partial bool StartOnLoginDisabled { get; set; }

Expand All @@ -34,7 +31,6 @@ public SettingsViewModel(ILogger<SettingsViewModel> logger, ISettingsManager<Cod
_connectSettings = settingsManager.Read().GetAwaiter().GetResult();
StartOnLogin = startupManager.IsEnabled();
ConnectOnLaunch = _connectSettings.ConnectOnLaunch;
DisableTailscaleLoopProtection = _connectSettings.EnableCorporateVpnSupport;

// Various policies can disable the "Start on login" option.
// We disable the option in the UI if the policy is set.
Expand All @@ -47,21 +43,6 @@ public SettingsViewModel(ILogger<SettingsViewModel> logger, ISettingsManager<Cod
}
}

partial void OnDisableTailscaleLoopProtectionChanged(bool oldValue, bool newValue)
{
if (oldValue == newValue)
return;
try
{
_connectSettings.EnableCorporateVpnSupport = DisableTailscaleLoopProtection;
_connectSettingsManager.Write(_connectSettings);
}
catch (Exception ex)
{
_logger.LogError($"Error saving Coder Connect {nameof(DisableTailscaleLoopProtection)} settings: {ex.Message}");
}
}

partial void OnConnectOnLaunchChanged(bool oldValue, bool newValue)
{
if (oldValue == newValue)
Expand All @@ -73,7 +54,7 @@ partial void OnConnectOnLaunchChanged(bool oldValue, bool newValue)
}
catch (Exception ex)
{
_logger.LogError($"Error saving Coder Connect {nameof(ConnectOnLaunch)} settings: {ex.Message}");
_logger.LogError($"Error saving Coder Connect settings: {ex.Message}");
}
}

Expand Down
6 changes: 0 additions & 6 deletions App/Views/Pages/SettingsMainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@
>
<ToggleSwitch IsOn="{x:Bind ViewModel.ConnectOnLaunch, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard Description="This setting loosens some VPN loop protection checks in Coder Connect, allowing traffic to flow to a Coder deployment behind a corporate VPN. We only recommend enabling this option if Coder Connect doesn't work with your Coder deployment behind a corporate VPN."
Header="Enable support for corporate VPNs"
HeaderIcon="{ui:FontIcon Glyph=&#xE705;}"
>
<ToggleSwitch IsOn="{x:Bind ViewModel.DisableTailscaleLoopProtection, Mode=TwoWay}" />
</controls:SettingsCard>
</StackPanel>
</Grid>
</ScrollViewer>
Expand Down
4 changes: 2 additions & 2 deletions App/Views/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
xmlns:winuiex="using:WinUIEx"
mc:Ignorable="d"
Title="Coder Settings"
Width="600" Height="500"
MinWidth="600" MinHeight="500">
Width="600" Height="350"
MinWidth="600" MinHeight="350">

<Window.SystemBackdrop>
<MicaBackdrop/>
Expand Down
3 changes: 1 addition & 2 deletions Vpn.Proto/vpn.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ message ServiceMessage {
StartResponse start = 2;
StopResponse stop = 3;
Status status = 4; // either in reply to a StatusRequest or broadcasted
StartProgress start_progress = 5; // broadcasted during startup (used exclusively by Windows)
StartProgress start_progress = 5; // broadcasted during startup
}
}

Expand Down Expand Up @@ -214,7 +214,6 @@ message NetworkSettingsResponse {
// StartResponse.
message StartRequest {
int32 tunnel_file_descriptor = 1;
bool tunnel_use_soft_net_isolation = 8;
string coder_url = 2;
string api_token = 3;
// Additional HTTP headers added to all requests
Expand Down
Loading