Skip to content
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

Implement Tunnel Configuration Check Feature #48

Merged
merged 8 commits into from
Dec 18, 2024

Conversation

KristijanMitrik
Copy link
Contributor

No description provided.

@KristijanMitrik KristijanMitrik self-assigned this Dec 17, 2024
@KristijanMitrik KristijanMitrik added the enhancement New feature or request label Dec 17, 2024
.vscode/launch.json Outdated Show resolved Hide resolved
lib/wireguard_dart_method_channel.dart Outdated Show resolved Hide resolved
return
}
Logger.main.debug("Connection configuration: \(cfg)")
Task {
do {
mgr.isEnabled = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point to do check before connect if we have separate methods to check before it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the tunnel had gotten disabled, re-enable and save it, then connect.

Copy link
Member

@Waldz Waldz Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it should as the pseudo code on application side:

if !checkTunnelConfiguration() {
   setupTunnel()
}

connect()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes correct, but if checkTunnelConfiguration returns true that means tunnel manager exists, but the tunnel can be disabled from system in some cases so it needs to be re-enabled before connecting.

check here: https://github.com/WireGuard/wireguard-apple/blob/2fec12a6e1f6e3460b6ee483aa00ad29cddadab1/Sources/WireGuardApp/Tunnel/TunnelsManager.swift#L665C9-L665C44

@@ -82,7 +96,6 @@ void CALLBACK ConnectionStatusObserver::ServiceNotifyCallback(void* ptr) {
std::unique_ptr<flutter::StreamHandlerError<flutter::EncodableValue>> ConnectionStatusObserver::OnListenInternal(
const flutter::EncodableValue* arguments, std::unique_ptr<flutter::EventSink<flutter::EncodableValue>>&& events) {
sink_ = std::move(events);
// sink_->Success(flutter::EncodableValue(ConnectionStatusToString(ConnectionStatus::disconnected)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@KristijanMitrik KristijanMitrik merged commit 77d87c7 into master Dec 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants