Remove connection prompts when applicable settings are changed by user

This commit is contained in:
Daniel
2023-12-22 11:00:14 +01:00
parent ceaf1546d2
commit 4ffc6e53b7
3 changed files with 51 additions and 5 deletions

View File

@@ -54,6 +54,9 @@ func prompt(ctx context.Context, conn *network.Connection) {
return
}
// Add prompt to connection.
conn.SetPrompt(n)
// Get decision timeout and make sure it does not exceed the ask timeout.
timeout := decisionTimeout
if timeout > askTimeout() {
@@ -65,8 +68,13 @@ func prompt(ctx context.Context, conn *network.Connection) {
case promptResponse := <-n.Response():
switch promptResponse {
case allowDomainAll, allowDomainDistinct, allowIP, allowServingIP:
// Accept
conn.Accept("allowed via prompt", profile.CfgOptionEndpointsKey)
default: // deny
case "":
// Dismissed
conn.Deny("prompting canceled, waiting for new decision", profile.CfgOptionDefaultActionKey)
default:
// Deny
conn.Deny("blocked via prompt", profile.CfgOptionEndpointsKey)
}