|
@@ -272,6 +272,16 @@ func main() {
|
|
|
defer tunDeviceFile.Close()
|
|
defer tunDeviceFile.Close()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Enable tactics when a NetworkID is specified
|
|
|
|
|
+ //
|
|
|
|
|
+ // Limitation: unlike psi.NetworkIDGetter, which calls back to platform
|
|
|
|
|
+ // APIs, this method of network identification is not dynamic and will not
|
|
|
|
|
+ // reflect network changes that occur while running.
|
|
|
|
|
+
|
|
|
|
|
+ if config.NetworkID != "" {
|
|
|
|
|
+ config.NetworkIDGetter = &networkGetter{networkID: config.NetworkID}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Run Psiphon
|
|
// Run Psiphon
|
|
|
|
|
|
|
|
controller, err := psiphon.NewController(config)
|
|
controller, err := psiphon.NewController(config)
|
|
@@ -351,3 +361,11 @@ func (p *tunProvider) GetPrimaryDnsServer() string {
|
|
|
func (p *tunProvider) GetSecondaryDnsServer() string {
|
|
func (p *tunProvider) GetSecondaryDnsServer() string {
|
|
|
return p.secondaryDNS
|
|
return p.secondaryDNS
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+type networkGetter struct {
|
|
|
|
|
+ networkID string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (n *networkGetter) GetNetworkID() string {
|
|
|
|
|
+ return n.networkID
|
|
|
|
|
+}
|