aboutsummaryrefslogtreecommitdiffstats
path: root/Sources/WireGuardIntentsExtension/IntentHandler.swift
blob: 62eb5e23f0fc7a424630094adcf868ae3cead979 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

import Intents

class IntentHandler: INExtension {

    override init() {
        super.init()
        Logger.configureGlobal(tagged: "INTENTS", withFilePath: FileManager.logFileURL?.path)
    }

    override func handler(for intent: INIntent) -> Any {
        guard intent is GetPeersIntent || intent is UpdateConfigurationIntent else {
            fatalError("Unhandled intent type: \(intent)")
        }

        return IntentHandling()
    }

}