@@ -16,28 +16,32 @@ import io.matthewnelson.topl_service.onionproxy.OnionProxyEventBroadcaster
16
16
import io.matthewnelson.topl_service.onionproxy.OnionProxyEventListener
17
17
import io.matthewnelson.topl_service.onionproxy.OnionProxyInstaller
18
18
import io.matthewnelson.topl_service.service.ActionConsts.ServiceAction
19
+ import net.freehaven.tor.control.EventListener
19
20
20
21
internal class TorService : Service () {
21
22
22
23
companion object {
23
24
private lateinit var torConfigFiles: TorConfigFiles
24
25
private lateinit var torSettings: TorSettings
25
- private var buildConfigVersion: Int = - 1
26
+ private var additionalEventListener: EventListener ? = null
27
+ private var buildConfigVersionCode: Int = - 1
26
28
private lateinit var geoipAssetPath: String
27
29
private lateinit var geoip6AssetPath: String
28
30
29
31
fun initialize (
30
- config : TorConfigFiles ,
31
- settings : TorSettings ,
32
- buildVersion : Int ,
33
- geoipPath : String ,
34
- geoip6Path : String
32
+ torConfigFiles : TorConfigFiles ,
33
+ torSettings : TorSettings ,
34
+ additionalEventListener : EventListener ? ,
35
+ buildConfigVersionCode : Int ,
36
+ geoipAssetPath : String ,
37
+ geoip6AssetPath : String
35
38
) {
36
- torConfigFiles = config
37
- torSettings = settings
38
- buildConfigVersion = buildVersion
39
- geoipAssetPath = geoipPath
40
- geoip6AssetPath = geoip6Path
39
+ this .torConfigFiles = torConfigFiles
40
+ this .torSettings = torSettings
41
+ this .additionalEventListener = additionalEventListener
42
+ this .buildConfigVersionCode = buildConfigVersionCode
43
+ this .geoipAssetPath = geoipAssetPath
44
+ this .geoip6AssetPath = geoip6AssetPath
41
45
}
42
46
43
47
// Intents/LocalBroadcastManager
@@ -59,7 +63,7 @@ internal class TorService: Service() {
59
63
val onionProxyInstaller = OnionProxyInstaller (
60
64
this ,
61
65
torConfigFiles,
62
- buildConfigVersion ,
66
+ buildConfigVersionCode ,
63
67
geoipAssetPath,
64
68
geoip6AssetPath
65
69
)
@@ -69,11 +73,13 @@ internal class TorService: Service() {
69
73
torServiceSettings
70
74
)
71
75
val onionProxyEventBroadcaster = OnionProxyEventBroadcaster (this , torServiceSettings)
76
+ val onionProxyEventListener = OnionProxyEventListener (this , onionProxyEventBroadcaster)
72
77
onionProxyManager = OnionProxyManager (
73
78
this ,
74
79
onionProxyContext,
75
80
onionProxyEventBroadcaster,
76
- OnionProxyEventListener (this , onionProxyEventBroadcaster)
81
+ onionProxyEventListener,
82
+ arrayOf(additionalEventListener)
77
83
)
78
84
onionProxyManager.setup()
79
85
}
0 commit comments