diff options
author | irregulator <irregulator@riseup.net> | 2014-05-22 14:34:55 +0300 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-07-01 16:05:41 -0700 |
commit | 2f318f0be937f0bace467640f4011ba422a736b7 (patch) | |
tree | 2d89df4381c72aa5979676c34083274b2698a064 /provider_base/services/obfsproxy.json | |
parent | 1a0161da0ff420d26732b492898ebf0074b2292c (diff) |
Pick gateway address either from self or another openvpn node
Diffstat (limited to 'provider_base/services/obfsproxy.json')
-rw-r--r-- | provider_base/services/obfsproxy.json | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/provider_base/services/obfsproxy.json b/provider_base/services/obfsproxy.json index 792a4183..d6771148 100644 --- a/provider_base/services/obfsproxy.json +++ b/provider_base/services/obfsproxy.json @@ -4,6 +4,11 @@ "password": "= base32_secret :scramblesuit_password", "port" : "= rand_range :scramblesuit_port, 18000..32000" }, - "gateway_address": "= nodes[:services => 'openvpn'].field('openvpn.gateway_address')[0]" + "gateway_address": "= self['openvpn'] ? openvpn.gateway_address : nodes_like_me[:services => 'openvpn'].field('openvpn.gateway_address').shuffle.first" + // Later, if we add a SafeNil class that looks and acts like nil + // but will allow you to call methods on it (each returning another SafeNil) + // without throwing an exception, we could do: + // "gateway_address": "= self['openvpn'] ? openvpn.gateway_address : (nodes_like_me[:services => 'openvpn']['location.name' => location.name].field('openvpn.gateway_address').shuffle.first || nodes_like_me[:services => 'openvpn'].field('openvpn.gateway_address').shuffle.first)" + // Perhaps we should also create a macro. } } |