parameters.go 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396
  1. /*
  2. * Copyright (c) 2018, Psiphon Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. /*
  20. Package parameters implements dynamic, concurrency-safe parameters that
  21. determine Psiphon client and server behaviors.
  22. Parameters include network timeouts, probabilities for actions, lists of
  23. protocols, etc. Parameters are initialized with reasonable defaults. New
  24. values may be applied, allowing the client or server to customize its
  25. parameters from both a config file and tactics data. Sane minimum values are
  26. enforced.
  27. Parameters may be read and updated concurrently. The read mechanism offers a
  28. snapshot so that related parameters, such as two Ints representing a range; or
  29. a more complex series of related parameters; may be read in an atomic and
  30. consistent way. For example:
  31. p := params.Get()
  32. min := p.Int("Min")
  33. max := p.Int("Max")
  34. p = nil
  35. For long-running operations, it is recommended to set any pointer to the
  36. snapshot to nil to allow garbage collection of old snaphots in cases where the
  37. parameters change.
  38. In general, parameters should be read as close to the point of use as possible
  39. to ensure that dynamic changes to the parameter values take effect.
  40. For duration parameters, time.ParseDuration-compatible string values are
  41. supported when applying new values. This allows specifying durations as, for
  42. example, "100ms" or "24h".
  43. Values read from the parameters are not deep copies and must be treated as
  44. read-only.
  45. */
  46. package parameters
  47. import (
  48. "encoding/json"
  49. "net/http"
  50. "reflect"
  51. "sync/atomic"
  52. "time"
  53. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
  54. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
  55. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/obfuscator"
  56. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/prng"
  57. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol"
  58. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/transforms"
  59. "golang.org/x/net/bpf"
  60. )
  61. const (
  62. NetworkLatencyMultiplier = "NetworkLatencyMultiplier"
  63. NetworkLatencyMultiplierMin = "NetworkLatencyMultiplierMin"
  64. NetworkLatencyMultiplierMax = "NetworkLatencyMultiplierMax"
  65. NetworkLatencyMultiplierLambda = "NetworkLatencyMultiplierLambda"
  66. TacticsWaitPeriod = "TacticsWaitPeriod"
  67. TacticsRetryPeriod = "TacticsRetryPeriod"
  68. TacticsRetryPeriodJitter = "TacticsRetryPeriodJitter"
  69. TacticsTimeout = "TacticsTimeout"
  70. ConnectionWorkerPoolSize = "ConnectionWorkerPoolSize"
  71. TunnelPoolSize = "TunnelPoolSize"
  72. TunnelConnectTimeout = "TunnelConnectTimeout"
  73. EstablishTunnelTimeout = "EstablishTunnelTimeout"
  74. EstablishTunnelWorkTime = "EstablishTunnelWorkTime"
  75. EstablishTunnelPausePeriod = "EstablishTunnelPausePeriod"
  76. EstablishTunnelPausePeriodJitter = "EstablishTunnelPausePeriodJitter"
  77. EstablishTunnelServerAffinityGracePeriod = "EstablishTunnelServerAffinityGracePeriod"
  78. StaggerConnectionWorkersPeriod = "StaggerConnectionWorkersPeriod"
  79. StaggerConnectionWorkersJitter = "StaggerConnectionWorkersJitter"
  80. LimitIntensiveConnectionWorkers = "LimitIntensiveConnectionWorkers"
  81. UpstreamProxyErrorMinWaitDuration = "UpstreamProxyErrorMinWaitDuration"
  82. UpstreamProxyErrorMaxWaitDuration = "UpstreamProxyErrorMaxWaitDuration"
  83. IgnoreHandshakeStatsRegexps = "IgnoreHandshakeStatsRegexps"
  84. PrioritizeTunnelProtocolsProbability = "PrioritizeTunnelProtocolsProbability"
  85. PrioritizeTunnelProtocols = "PrioritizeTunnelProtocols"
  86. PrioritizeTunnelProtocolsCandidateCount = "PrioritizeTunnelProtocolsCandidateCount"
  87. InitialLimitTunnelProtocolsProbability = "InitialLimitTunnelProtocolsProbability"
  88. InitialLimitTunnelProtocols = "InitialLimitTunnelProtocols"
  89. InitialLimitTunnelProtocolsCandidateCount = "InitialLimitTunnelProtocolsCandidateCount"
  90. LimitTunnelProtocolsProbability = "LimitTunnelProtocolsProbability"
  91. LimitTunnelProtocols = "LimitTunnelProtocols"
  92. LimitTunnelDialPortNumbersProbability = "LimitTunnelDialPortNumbersProbability"
  93. LimitTunnelDialPortNumbers = "LimitTunnelDialPortNumbers"
  94. LimitTLSProfilesProbability = "LimitTLSProfilesProbability"
  95. LimitTLSProfiles = "LimitTLSProfiles"
  96. UseOnlyCustomTLSProfiles = "UseOnlyCustomTLSProfiles"
  97. CustomTLSProfiles = "CustomTLSProfiles"
  98. SelectRandomizedTLSProfileProbability = "SelectRandomizedTLSProfileProbability"
  99. NoDefaultTLSSessionIDProbability = "NoDefaultTLSSessionIDProbability"
  100. DisableFrontingProviderTLSProfiles = "DisableFrontingProviderTLSProfiles"
  101. LimitQUICVersionsProbability = "LimitQUICVersionsProbability"
  102. LimitQUICVersions = "LimitQUICVersions"
  103. DisableFrontingProviderQUICVersions = "DisableFrontingProviderQUICVersions"
  104. QUICDialEarlyProbability = "QUICDialEarlyProbability"
  105. QUICObfuscatedPSKProbability = "QUICObfuscatedPSKProbability"
  106. QUICDisableClientPathMTUDiscoveryProbability = "QUICDisableClientPathMTUDiscoveryProbability"
  107. FragmentorProbability = "FragmentorProbability"
  108. FragmentorLimitProtocols = "FragmentorLimitProtocols"
  109. FragmentorMinTotalBytes = "FragmentorMinTotalBytes"
  110. FragmentorMaxTotalBytes = "FragmentorMaxTotalBytes"
  111. FragmentorMinWriteBytes = "FragmentorMinWriteBytes"
  112. FragmentorMaxWriteBytes = "FragmentorMaxWriteBytes"
  113. FragmentorMinDelay = "FragmentorMinDelay"
  114. FragmentorMaxDelay = "FragmentorMaxDelay"
  115. FragmentorDownstreamProbability = "FragmentorDownstreamProbability"
  116. FragmentorDownstreamLimitProtocols = "FragmentorDownstreamLimitProtocols"
  117. FragmentorDownstreamMinTotalBytes = "FragmentorDownstreamMinTotalBytes"
  118. FragmentorDownstreamMaxTotalBytes = "FragmentorDownstreamMaxTotalBytes"
  119. FragmentorDownstreamMinWriteBytes = "FragmentorDownstreamMinWriteBytes"
  120. FragmentorDownstreamMaxWriteBytes = "FragmentorDownstreamMaxWriteBytes"
  121. FragmentorDownstreamMinDelay = "FragmentorDownstreamMinDelay"
  122. FragmentorDownstreamMaxDelay = "FragmentorDownstreamMaxDelay"
  123. ObfuscatedSSHMinPadding = "ObfuscatedSSHMinPadding"
  124. ObfuscatedSSHMaxPadding = "ObfuscatedSSHMaxPadding"
  125. TunnelOperateShutdownTimeout = "TunnelOperateShutdownTimeout"
  126. TunnelPortForwardDialTimeout = "TunnelPortForwardDialTimeout"
  127. PacketTunnelReadTimeout = "PacketTunnelReadTimeout"
  128. TunnelRateLimits = "TunnelRateLimits"
  129. AdditionalCustomHeaders = "AdditionalCustomHeaders"
  130. SpeedTestPaddingMinBytes = "SpeedTestPaddingMinBytes"
  131. SpeedTestPaddingMaxBytes = "SpeedTestPaddingMaxBytes"
  132. SpeedTestMaxSampleCount = "SpeedTestMaxSampleCount"
  133. SSHKeepAliveSpeedTestSampleProbability = "SSHKeepAliveSpeedTestSampleProbability"
  134. SSHKeepAlivePaddingMinBytes = "SSHKeepAlivePaddingMinBytes"
  135. SSHKeepAlivePaddingMaxBytes = "SSHKeepAlivePaddingMaxBytes"
  136. SSHKeepAlivePeriodMin = "SSHKeepAlivePeriodMin"
  137. SSHKeepAlivePeriodMax = "SSHKeepAlivePeriodMax"
  138. SSHKeepAlivePeriodicTimeout = "SSHKeepAlivePeriodicTimeout"
  139. SSHKeepAlivePeriodicInactivePeriod = "SSHKeepAlivePeriodicInactivePeriod"
  140. SSHKeepAliveProbeTimeout = "SSHKeepAliveProbeTimeout"
  141. SSHKeepAliveProbeInactivePeriod = "SSHKeepAliveProbeInactivePeriod"
  142. SSHKeepAliveNetworkConnectivityPollingPeriod = "SSHKeepAliveNetworkConnectivityPollingPeriod"
  143. SSHKeepAliveResetOnFailureProbability = "SSHKeepAliveResetOnFailureProbability"
  144. HTTPProxyOriginServerTimeout = "HTTPProxyOriginServerTimeout"
  145. HTTPProxyMaxIdleConnectionsPerHost = "HTTPProxyMaxIdleConnectionsPerHost"
  146. FetchRemoteServerListTimeout = "FetchRemoteServerListTimeout"
  147. FetchRemoteServerListRetryPeriod = "FetchRemoteServerListRetryPeriod"
  148. FetchRemoteServerListStalePeriod = "FetchRemoteServerListStalePeriod"
  149. RemoteServerListSignaturePublicKey = "RemoteServerListSignaturePublicKey"
  150. RemoteServerListURLs = "RemoteServerListURLs"
  151. ObfuscatedServerListRootURLs = "ObfuscatedServerListRootURLs"
  152. PsiphonAPIRequestTimeout = "PsiphonAPIRequestTimeout"
  153. PsiphonAPIStatusRequestPeriodMin = "PsiphonAPIStatusRequestPeriodMin"
  154. PsiphonAPIStatusRequestPeriodMax = "PsiphonAPIStatusRequestPeriodMax"
  155. PsiphonAPIStatusRequestShortPeriodMin = "PsiphonAPIStatusRequestShortPeriodMin"
  156. PsiphonAPIStatusRequestShortPeriodMax = "PsiphonAPIStatusRequestShortPeriodMax"
  157. PsiphonAPIStatusRequestPaddingMinBytes = "PsiphonAPIStatusRequestPaddingMinBytes"
  158. PsiphonAPIStatusRequestPaddingMaxBytes = "PsiphonAPIStatusRequestPaddingMaxBytes"
  159. PsiphonAPIPersistentStatsMaxCount = "PsiphonAPIPersistentStatsMaxCount"
  160. PsiphonAPIConnectedRequestPeriod = "PsiphonAPIConnectedRequestPeriod"
  161. PsiphonAPIConnectedRequestRetryPeriod = "PsiphonAPIConnectedRequestRetryPeriod"
  162. FetchSplitTunnelRoutesTimeout = "FetchSplitTunnelRoutesTimeout"
  163. SplitTunnelRoutesURLFormat = "SplitTunnelRoutesURLFormat"
  164. SplitTunnelRoutesSignaturePublicKey = "SplitTunnelRoutesSignaturePublicKey"
  165. SplitTunnelDNSServer = "SplitTunnelDNSServer"
  166. SplitTunnelClassificationTTL = "SplitTunnelClassificationTTL"
  167. SplitTunnelClassificationMaxEntries = "SplitTunnelClassificationMaxEntries"
  168. FetchUpgradeTimeout = "FetchUpgradeTimeout"
  169. FetchUpgradeRetryPeriod = "FetchUpgradeRetryPeriod"
  170. FetchUpgradeStalePeriod = "FetchUpgradeStalePeriod"
  171. UpgradeDownloadURLs = "UpgradeDownloadURLs"
  172. UpgradeDownloadClientVersionHeader = "UpgradeDownloadClientVersionHeader"
  173. TotalBytesTransferredNoticePeriod = "TotalBytesTransferredNoticePeriod"
  174. TotalBytesTransferredEmitMemoryMetrics = "TotalBytesTransferredEmitMemoryMetrics"
  175. MeekDialDomainsOnly = "MeekDialDomainsOnly"
  176. MeekLimitBufferSizes = "MeekLimitBufferSizes"
  177. MeekCookieMaxPadding = "MeekCookieMaxPadding"
  178. MeekFullReceiveBufferLength = "MeekFullReceiveBufferLength"
  179. MeekReadPayloadChunkLength = "MeekReadPayloadChunkLength"
  180. MeekLimitedFullReceiveBufferLength = "MeekLimitedFullReceiveBufferLength"
  181. MeekLimitedReadPayloadChunkLength = "MeekLimitedReadPayloadChunkLength"
  182. MeekMinPollInterval = "MeekMinPollInterval"
  183. MeekMinPollIntervalJitter = "MeekMinPollIntervalJitter"
  184. MeekMaxPollInterval = "MeekMaxPollInterval"
  185. MeekMaxPollIntervalJitter = "MeekMaxPollIntervalJitter"
  186. MeekPollIntervalMultiplier = "MeekPollIntervalMultiplier"
  187. MeekPollIntervalJitter = "MeekPollIntervalJitter"
  188. MeekApplyPollIntervalMultiplierProbability = "MeekApplyPollIntervalMultiplierProbability"
  189. MeekRoundTripRetryDeadline = "MeekRoundTripRetryDeadline"
  190. MeekRoundTripRetryMinDelay = "MeekRoundTripRetryMinDelay"
  191. MeekRoundTripRetryMaxDelay = "MeekRoundTripRetryMaxDelay"
  192. MeekRoundTripRetryMultiplier = "MeekRoundTripRetryMultiplier"
  193. MeekRoundTripTimeout = "MeekRoundTripTimeout"
  194. MeekTrafficShapingProbability = "MeekTrafficShapingProbability"
  195. MeekTrafficShapingLimitProtocols = "MeekTrafficShapingLimitProtocols"
  196. MeekMinTLSPadding = "MeekMinTLSPadding"
  197. MeekMaxTLSPadding = "MeekMaxTLSPadding"
  198. MeekMinLimitRequestPayloadLength = "MeekMinLimitRequestPayloadLength"
  199. MeekMaxLimitRequestPayloadLength = "MeekMaxLimitRequestPayloadLength"
  200. MeekRedialTLSProbability = "MeekRedialTLSProbability"
  201. MeekAlternateCookieNameProbability = "MeekAlternateCookieNameProbability"
  202. MeekAlternateContentTypeProbability = "MeekAlternateContentTypeProbability"
  203. TransformHostNameProbability = "TransformHostNameProbability"
  204. PickUserAgentProbability = "PickUserAgentProbability"
  205. InitialLivenessTest = "InitialLivenessTest"
  206. LivenessTest = "LivenessTest"
  207. LivenessTestMinUpstreamBytes = "LivenessTestMinUpstreamBytes"
  208. LivenessTestMaxUpstreamBytes = "LivenessTestMaxUpstreamBytes"
  209. LivenessTestMinDownstreamBytes = "LivenessTestMinDownstreamBytes"
  210. LivenessTestMaxDownstreamBytes = "LivenessTestMaxDownstreamBytes"
  211. ReplayCandidateCount = "ReplayCandidateCount"
  212. ReplayDialParametersTTL = "ReplayDialParametersTTL"
  213. ReplayTargetUpstreamBytes = "ReplayTargetUpstreamBytes"
  214. ReplayTargetDownstreamBytes = "ReplayTargetDownstreamBytes"
  215. ReplayTargetTunnelDuration = "ReplayTargetTunnelDuration"
  216. ReplayLaterRoundMoveToFrontProbability = "ReplayLaterRoundMoveToFrontProbability"
  217. ReplayRetainFailedProbability = "ReplayRetainFailedProbability"
  218. ReplayIgnoreChangedConfigState = "ReplayIgnoreChangedConfigState"
  219. ReplayBPF = "ReplayBPF"
  220. ReplaySSH = "ReplaySSH"
  221. ReplayObfuscatorPadding = "ReplayObfuscatorPadding"
  222. ReplayFragmentor = "ReplayFragmentor"
  223. ReplayTLSProfile = "ReplayTLSProfile"
  224. ReplayFronting = "ReplayFronting"
  225. ReplayHostname = "ReplayHostname"
  226. ReplayQUICVersion = "ReplayQUICVersion"
  227. ReplayObfuscatedQUIC = "ReplayObfuscatedQUIC"
  228. ReplayObfuscatedQUICNonceTransformer = "ReplayObfuscatedQUICNonceTransformer"
  229. ReplayConjureRegistration = "ReplayConjureRegistration"
  230. ReplayConjureTransport = "ReplayConjureTransport"
  231. ReplayLivenessTest = "ReplayLivenessTest"
  232. ReplayUserAgent = "ReplayUserAgent"
  233. ReplayAPIRequestPadding = "ReplayAPIRequestPadding"
  234. ReplayHoldOffTunnel = "ReplayHoldOffTunnel"
  235. ReplayResolveParameters = "ReplayResolveParameters"
  236. ReplayHTTPTransformerParameters = "ReplayHTTPTransformerParameters"
  237. ReplayOSSHSeedTransformerParameters = "ReplayOSSHSeedTransformerParameters"
  238. ReplayOSSHPrefix = "ReplayOSSHPrefix"
  239. ReplayTLSFragmentClientHello = "ReplayTLSFragmentClientHello"
  240. ReplayInproxyWebRTC = "ReplayInproxyWebRTC"
  241. ReplayInproxySTUN = "ReplayInproxySTUN"
  242. APIRequestUpstreamPaddingMinBytes = "APIRequestUpstreamPaddingMinBytes"
  243. APIRequestUpstreamPaddingMaxBytes = "APIRequestUpstreamPaddingMaxBytes"
  244. APIRequestDownstreamPaddingMinBytes = "APIRequestDownstreamPaddingMinBytes"
  245. APIRequestDownstreamPaddingMaxBytes = "APIRequestDownstreamPaddingMaxBytes"
  246. PersistentStatsMaxStoreRecords = "PersistentStatsMaxStoreRecords"
  247. PersistentStatsMaxSendBytes = "PersistentStatsMaxSendBytes"
  248. RecordRemoteServerListPersistentStatsProbability = "RecordRemoteServerListPersistentStatsProbability"
  249. RecordFailedTunnelPersistentStatsProbability = "RecordFailedTunnelPersistentStatsProbability"
  250. ServerEntryMinimumAgeForPruning = "ServerEntryMinimumAgeForPruning"
  251. ApplicationParameters = "ApplicationParameters"
  252. BPFServerTCPProgram = "BPFServerTCPProgram"
  253. BPFServerTCPProbability = "BPFServerTCPProbability"
  254. BPFClientTCPProgram = "BPFClientTCPProgram"
  255. BPFClientTCPProbability = "BPFClientTCPProbability"
  256. ServerPacketManipulationSpecs = "ServerPacketManipulationSpecs"
  257. ServerProtocolPacketManipulations = "ServerProtocolPacketManipulations"
  258. ServerPacketManipulationProbability = "ServerPacketManipulationProbability"
  259. FeedbackUploadURLs = "FeedbackUploadURLs"
  260. FeedbackEncryptionPublicKey = "FeedbackEncryptionPublicKey"
  261. FeedbackTacticsWaitPeriod = "FeedbackTacticsWaitPeriod"
  262. FeedbackUploadMaxAttempts = "FeedbackUploadMaxAttempts"
  263. FeedbackUploadRetryMinDelaySeconds = "FeedbackUploadRetryMinDelaySeconds"
  264. FeedbackUploadRetryMaxDelaySeconds = "FeedbackUploadRetryMaxDelaySeconds"
  265. FeedbackUploadTimeoutSeconds = "FeedbackUploadTimeoutSeconds"
  266. ServerReplayPacketManipulation = "ServerReplayPacketManipulation"
  267. ServerReplayFragmentor = "ServerReplayFragmentor"
  268. ServerReplayUnknownGeoIP = "ServerReplayUnknownGeoIP"
  269. ServerReplayTTL = "ServerReplayTTL"
  270. ServerReplayTargetWaitDuration = "ServerReplayTargetWaitDuration"
  271. ServerReplayTargetTunnelDuration = "ServerReplayTargetTunnelDuration"
  272. ServerReplayTargetUpstreamBytes = "ServerReplayTargetUpstreamBytes"
  273. ServerReplayTargetDownstreamBytes = "ServerReplayTargetDownstreamBytes"
  274. ServerReplayFailedCountThreshold = "ServerReplayFailedCountThreshold"
  275. ServerBurstUpstreamDeadline = "ServerBurstUpstreamDeadline"
  276. ServerBurstUpstreamTargetBytes = "ServerBurstUpstreamTargetBytes"
  277. ServerBurstDownstreamDeadline = "ServerBurstDownstreamDeadline"
  278. ServerBurstDownstreamTargetBytes = "ServerBurstDownstreamTargetBytes"
  279. ClientBurstUpstreamDeadline = "ClientBurstUpstreamDeadline"
  280. ClientBurstUpstreamTargetBytes = "ClientBurstUpstreamTargetBytes"
  281. ClientBurstDownstreamDeadline = "ClientBurstDownstreamDeadline"
  282. ClientBurstDownstreamTargetBytes = "ClientBurstDownstreamTargetBytes"
  283. ConjureCachedRegistrationTTL = "ConjureCachedRegistrationTTL"
  284. ConjureAPIRegistrarURL = "ConjureAPIRegistrarURL"
  285. ConjureAPIRegistrarBidirectionalURL = "ConjureAPIRegistrarBidirectionalURL"
  286. ConjureAPIRegistrarFrontingSpecs = "ConjureAPIRegistrarFrontingSpecs"
  287. ConjureAPIRegistrarMinDelay = "ConjureAPIRegistrarMinDelay"
  288. ConjureAPIRegistrarMaxDelay = "ConjureAPIRegistrarMaxDelay"
  289. ConjureDecoyRegistrarProbability = "ConjureDecoyRegistrarProbability"
  290. ConjureDecoyRegistrarWidth = "ConjureDecoyRegistrarWidth"
  291. ConjureDecoyRegistrarMinDelay = "ConjureDecoyRegistrarMinDelay"
  292. ConjureDecoyRegistrarMaxDelay = "ConjureDecoyRegistrarMaxDelay"
  293. ConjureEnableIPv6Dials = "ConjureEnableIPv6Dials"
  294. ConjureEnablePortRandomization = "ConjureEnablePortRandomization"
  295. ConjureEnableRegistrationOverrides = "ConjureEnableRegistrationOverrides"
  296. ConjureLimitTransportsProbability = "ConjureLimitTransportsProbability"
  297. ConjureLimitTransports = "ConjureLimitTransports"
  298. ConjureSTUNServerAddresses = "ConjureSTUNServerAddresses"
  299. ConjureDTLSEmptyInitialPacketProbability = "ConjureDTLSEmptyInitialPacketProbability"
  300. CustomHostNameRegexes = "CustomHostNameRegexes"
  301. CustomHostNameProbability = "CustomHostNameProbability"
  302. CustomHostNameLimitProtocols = "CustomHostNameLimitProtocols"
  303. HoldOffTunnelMinDuration = "HoldOffTunnelMinDuration"
  304. HoldOffTunnelMaxDuration = "HoldOffTunnelMaxDuration"
  305. HoldOffTunnelProtocols = "HoldOffTunnelProtocols"
  306. HoldOffTunnelFrontingProviderIDs = "HoldOffTunnelFrontingProviderIDs"
  307. HoldOffTunnelProbability = "HoldOffTunnelProbability"
  308. HoldOffTunnelProtocolMinDuration = "HoldOffTunnelProtocolMinDuration"
  309. HoldOffTunnelProtocolMaxDuration = "HoldOffTunnelProtocolMaxDuration"
  310. HoldOffTunnelProtocolNames = "HoldOffTunnelProtocolNames"
  311. HoldOffTunnelProtocolProbability = "HoldOffTunnelProtocolProbability"
  312. HoldOffFrontingTunnelMinDuration = "HoldOffFrontingTunnelMinDuration"
  313. HoldOffFrontingTunnelMaxDuration = "HoldOffFrontingTunnelMaxDuration"
  314. HoldOffFrontingTunnelProviderIDs = "HoldOffFrontingTunnelProviderIDs"
  315. HoldOffFrontingTunnelProbability = "HoldOffFrontingTunnelProbability"
  316. RestrictFrontingProviderIDs = "RestrictFrontingProviderIDs"
  317. RestrictFrontingProviderIDsServerProbability = "RestrictFrontingProviderIDsServerProbability"
  318. RestrictFrontingProviderIDsClientProbability = "RestrictFrontingProviderIDsClientProbability"
  319. HoldOffDirectTunnelMinDuration = "HoldOffDirectTunnelMinDuration"
  320. HoldOffDirectTunnelMaxDuration = "HoldOffDirectTunnelMaxDuration"
  321. HoldOffDirectTunnelProviderRegions = "HoldOffDirectTunnelProviderRegions"
  322. HoldOffDirectTunnelProbability = "HoldOffDirectTunnelProbability"
  323. RestrictDirectProviderRegions = "RestrictDirectProviderRegions"
  324. RestrictDirectProviderIDsServerProbability = "RestrictDirectProviderIDsServerProbability"
  325. RestrictDirectProviderIDsClientProbability = "RestrictDirectProviderIDsClientProbability"
  326. HoldOffInproxyTunnelMinDuration = "HoldOffInproxyTunnelMinDuration"
  327. HoldOffInproxyTunnelMaxDuration = "HoldOffInproxyTunnelMaxDuration"
  328. HoldOffInproxyTunnelProviderRegions = "HoldOffInproxyTunnelProviderRegions"
  329. HoldOffInproxyTunnelProbability = "HoldOffInproxyTunnelProbability"
  330. RestrictInproxyProviderRegions = "RestrictInproxyProviderRegions"
  331. RestrictInproxyProviderIDsServerProbability = "RestrictInproxyProviderIDsServerProbability"
  332. RestrictInproxyProviderIDsClientProbability = "RestrictInproxyProviderIDsClientProbability"
  333. UpstreamProxyAllowAllServerEntrySources = "UpstreamProxyAllowAllServerEntrySources"
  334. DestinationBytesMetricsASN = "DestinationBytesMetricsASN"
  335. DestinationBytesMetricsASNs = "DestinationBytesMetricsASNs"
  336. DNSResolverAttemptsPerServer = "DNSResolverAttemptsPerServer"
  337. DNSResolverAttemptsPerPreferredServer = "DNSResolverAttemptsPerPreferredServer"
  338. DNSResolverRequestTimeout = "DNSResolverRequestTimeout"
  339. DNSResolverAwaitTimeout = "DNSResolverAwaitTimeout"
  340. DNSResolverPreresolvedIPAddressCIDRs = "DNSResolverPreresolvedIPAddressCIDRs"
  341. DNSResolverPreresolvedIPAddressProbability = "DNSResolverPreresolvedIPAddressProbability"
  342. DNSResolverAlternateServers = "DNSResolverAlternateServers"
  343. DNSResolverPreferredAlternateServers = "DNSResolverPreferredAlternateServers"
  344. DNSResolverPreferAlternateServerProbability = "DNSResolverPreferAlternateServerProbability"
  345. DNSResolverProtocolTransformSpecs = "DNSResolverProtocolTransformSpecs"
  346. DNSResolverProtocolTransformScopedSpecNames = "DNSResolverProtocolTransformScopedSpecNames"
  347. DNSResolverProtocolTransformProbability = "DNSResolverProtocolTransformProbability"
  348. DNSResolverIncludeEDNS0Probability = "DNSResolverIncludeEDNS0Probability"
  349. DNSResolverCacheExtensionInitialTTL = "DNSResolverCacheExtensionInitialTTL"
  350. DNSResolverCacheExtensionVerifiedTTL = "DNSResolverCacheExtensionVerifiedTTL"
  351. DNSResolverQNameRandomizeCasingProbability = "DNSResolverQNameRandomizeCasingProbability"
  352. DNSResolverQNameMustMatchProbability = "DNSResolverQNameMustMatchProbability"
  353. AddFrontingProviderPsiphonFrontingHeader = "AddFrontingProviderPsiphonFrontingHeader"
  354. DirectHTTPProtocolTransformSpecs = "DirectHTTPProtocolTransformSpecs"
  355. DirectHTTPProtocolTransformScopedSpecNames = "DirectHTTPProtocolTransformScopedSpecNames"
  356. DirectHTTPProtocolTransformProbability = "DirectHTTPProtocolTransformProbability"
  357. FrontedHTTPProtocolTransformSpecs = "FrontedHTTPProtocolTransformSpecs"
  358. FrontedHTTPProtocolTransformScopedSpecNames = "FrontedHTTPProtocolTransformScopedSpecNames"
  359. FrontedHTTPProtocolTransformProbability = "FrontedHTTPProtocolTransformProbability"
  360. OSSHObfuscatorSeedTransformSpecs = "OSSHObfuscatorSeedTransformSpecs"
  361. OSSHObfuscatorSeedTransformScopedSpecNames = "OSSHObfuscatorSeedTransformScopedSpecNames"
  362. OSSHObfuscatorSeedTransformProbability = "OSSHObfuscatorSeedTransformProbability"
  363. ObfuscatedQUICNonceTransformSpecs = "ObfuscatedQUICNonceTransformSpecs"
  364. ObfuscatedQUICNonceTransformScopedSpecNames = "ObfuscatedQUICNonceTransformScopedSpecNames"
  365. ObfuscatedQUICNonceTransformProbability = "ObfuscatedQUICNonceTransformProbability"
  366. OSSHPrefixSpecs = "OSSHPrefixSpecs"
  367. OSSHPrefixScopedSpecNames = "OSSHPrefixScopedSpecNames"
  368. OSSHPrefixProbability = "OSSHPrefixProbability"
  369. OSSHPrefixSplitMinDelay = "OSSHPrefixSplitMinDelay"
  370. OSSHPrefixSplitMaxDelay = "OSSHPrefixSplitMaxDelay"
  371. OSSHPrefixEnableFragmentor = "OSSHPrefixEnableFragmentor"
  372. ServerOSSHPrefixSpecs = "ServerOSSHPrefixSpecs"
  373. ShadowsocksPrefixSpecs = "ShadowsocksPrefixSpecs"
  374. ShadowsocksPrefixScopedSpecNames = "ShadowsocksPrefixScopedSpecNames"
  375. ShadowsocksPrefixProbability = "ShadowsocksPrefixProbability"
  376. ReplayShadowsocksPrefix = "ReplayShadowsocksPrefix"
  377. TLSTunnelObfuscatedPSKProbability = "TLSTunnelObfuscatedPSKProbability"
  378. TLSTunnelTrafficShapingProbability = "TLSTunnelTrafficShapingProbability"
  379. TLSTunnelMinTLSPadding = "TLSTunnelMinTLSPadding"
  380. TLSTunnelMaxTLSPadding = "TLSTunnelMaxTLSPadding"
  381. TLSFragmentClientHelloProbability = "TLSFragmentClientHelloProbability"
  382. TLSFragmentClientHelloLimitProtocols = "TLSFragmentClientHelloLimitProtocols"
  383. SteeringIPCacheTTL = "SteeringIPCacheTTL"
  384. SteeringIPCacheMaxEntries = "SteeringIPCacheMaxEntries"
  385. SteeringIPProbability = "SteeringIPProbability"
  386. ServerDiscoveryStrategy = "ServerDiscoveryStrategy"
  387. FrontedHTTPClientReplayDialParametersTTL = "FrontedHTTPClientReplayDialParametersTTL"
  388. FrontedHTTPClientReplayUpdateFrequency = "FrontedHTTPClientReplayUpdateFrequency"
  389. FrontedHTTPClientReplayDialParametersProbability = "FrontedHTTPClientReplayDialParametersProbability"
  390. FrontedHTTPClientReplayRetainFailedProbability = "FrontedHTTPClientReplayRetainFailedProbability"
  391. InproxyAllowProxy = "InproxyAllowProxy"
  392. InproxyAllowClient = "InproxyAllowClient"
  393. InproxyAllowDomainFrontedDestinations = "InproxyAllowDomainFrontedDestinations"
  394. InproxyAllowMatchByRegion = "InproxyAllowMatchByRegion"
  395. InproxyAllowMatchByASN = "InproxyAllowMatchByASN"
  396. InproxyDisallowMatchByRegion = "InproxyDisallowMatchByRegion"
  397. InproxyDisallowMatchByASN = "InproxyDisallowMatchByASN"
  398. InproxyAllBrokerSpecs = "InproxyAllBrokerSpecs"
  399. InproxyBrokerSpecs = "InproxyBrokerSpecs"
  400. InproxyPersonalPairingBrokerSpecs = "InproxyPersonalPairingBrokerSpecs"
  401. InproxyProxyBrokerSpecs = "InproxyProxyBrokerSpecs"
  402. InproxyProxyPersonalPairingBrokerSpecs = "InproxyProxyPersonalPairingBrokerSpecs"
  403. InproxyClientBrokerSpecs = "InproxyClientBrokerSpecs"
  404. InproxyClientPersonalPairingBrokerSpecs = "InproxyClientPersonalPairingBrokerSpecs"
  405. InproxyReplayBrokerDialParametersTTL = "InproxyReplayBrokerDialParametersTTL"
  406. InproxyReplayBrokerUpdateFrequency = "InproxyReplayBrokerUpdateFrequency"
  407. InproxyReplayBrokerDialParametersProbability = "InproxyReplayBrokerDialParametersProbability"
  408. InproxyReplayBrokerRetainFailedProbability = "InproxyReplayBrokerRetainFailedProbability"
  409. InproxyAllCommonCompartmentIDs = "InproxyAllCommonCompartmentIDs"
  410. InproxyCommonCompartmentIDs = "InproxyCommonCompartmentIDs"
  411. InproxyMaxCompartmentIDListLength = "InproxyMaxCompartmentIDListLength"
  412. InproxyBrokerMatcherAnnouncementLimitEntryCount = "InproxyBrokerMatcherAnnouncementLimitEntryCount"
  413. InproxyBrokerMatcherAnnouncementRateLimitQuantity = "InproxyBrokerMatcherAnnouncementRateLimitQuantity"
  414. InproxyBrokerMatcherAnnouncementRateLimitInterval = "InproxyBrokerMatcherAnnouncementRateLimitInterval"
  415. InproxyBrokerMatcherAnnouncementNonlimitedProxyIDs = "InproxyBrokerMatcherAnnouncementNonlimitedProxyIDs"
  416. InproxyBrokerMatcherOfferLimitEntryCount = "InproxyBrokerMatcherOfferLimitEntryCount"
  417. InproxyBrokerMatcherOfferRateLimitQuantity = "InproxyBrokerMatcherOfferRateLimitQuantity"
  418. InproxyBrokerMatcherOfferRateLimitInterval = "InproxyBrokerMatcherOfferRateLimitInterval"
  419. InproxyBrokerMatcherPrioritizeProxiesProbability = "InproxyBrokerMatcherPrioritizeProxiesProbability"
  420. InproxyBrokerMatcherPrioritizeProxiesFilter = "InproxyBrokerMatcherPrioritizeProxiesFilter"
  421. InproxyBrokerMatcherPrioritizeProxiesMinVersion = "InproxyBrokerMatcherPrioritizeProxiesMinVersion"
  422. InproxyBrokerProxyAnnounceTimeout = "InproxyBrokerProxyAnnounceTimeout"
  423. InproxyBrokerClientOfferTimeout = "InproxyBrokerClientOfferTimeout"
  424. InproxyBrokerClientOfferPersonalTimeout = "InproxyBrokerClientOfferPersonalTimeout"
  425. InproxyBrokerPendingServerRequestsTTL = "InproxyBrokerPendingServerRequestsTTL"
  426. InproxyBrokerDSLRequestRateLimitQuantity = "InproxyBrokerDSLRequestRateLimitQuantity"
  427. InproxyBrokerDSLRequestRateLimitInterval = "InproxyBrokerDSLRequestRateLimitInterval"
  428. InproxySessionHandshakeRoundTripTimeout = "InproxySessionHandshakeRoundTripTimeout"
  429. InproxyProxyAnnounceRequestTimeout = "InproxyProxyAnnounceRequestTimeout"
  430. InproxyProxyAnnounceDelay = "InproxyProxyAnnounceDelay"
  431. InproxyProxyAnnounceDelayJitter = "InproxyProxyAnnounceDelayJitter"
  432. InproxyProxyAnnounceMaxBackoffDelay = "InproxyProxyAnnounceMaxBackoffDelay"
  433. InproxyProxyAnswerRequestTimeout = "InproxyProxyAnswerRequestTimeout"
  434. InproxyClientOfferRequestTimeout = "InproxyClientOfferRequestTimeout"
  435. InproxyClientOfferRequestPersonalTimeout = "InproxyClientOfferRequestPersonalTimeout"
  436. InproxyClientOfferRetryDelay = "InproxyClientOfferRetryDelay"
  437. InproxyClientOfferRetryJitter = "InproxyClientOfferRetryJitter"
  438. InproxyClientRelayedPacketRequestTimeout = "InproxyClientRelayedPacketRequestTimeout"
  439. InproxyClientDSLRequestTimeout = "InproxyClientDSLRequestTimeout"
  440. InproxyBrokerRoundTripStatusCodeFailureThreshold = "InproxyBrokerRoundTripStatusCodeFailureThreshold"
  441. InproxyDTLSRandomizationProbability = "InproxyDTLSRandomizationProbability"
  442. InproxyWebRTCMediaStreamsProbability = "InproxyWebRTCMediaStreamsProbability"
  443. InproxyWebRTCDataChannelTrafficShapingProbability = "InproxyWebRTCDataChannelTrafficShapingProbability"
  444. InproxyWebRTCDataChannelTrafficShapingParameters = "InproxyWebRTCDataChannelTrafficShapingParameters"
  445. InproxyWebRTCMediaStreamsTrafficShapingProbability = "InproxyWebRTCMediaStreamsTrafficShapingProbability"
  446. InproxyWebRTCMediaStreamsTrafficShapingParameters = "InproxyWebRTCMediaStreamsTrafficShapingParameters"
  447. InproxySTUNServerAddresses = "InproxySTUNServerAddresses"
  448. InproxySTUNServerAddressesRFC5780 = "InproxySTUNServerAddressesRFC5780"
  449. InproxyProxySTUNServerAddresses = "InproxyProxySTUNServerAddresses"
  450. InproxyProxySTUNServerAddressesRFC5780 = "InproxyProxySTUNServerAddressesRFC5780"
  451. InproxyClientSTUNServerAddresses = "InproxyClientSTUNServerAddresses"
  452. InproxyClientSTUNServerAddressesRFC5780 = "InproxyClientSTUNServerAddressesRFC5780"
  453. InproxyClientDiscoverNATProbability = "InproxyClientDiscoverNATProbability"
  454. InproxyDisableSTUN = "InproxyDisableSTUN"
  455. InproxyDisablePortMapping = "InproxyDisablePortMapping"
  456. InproxyDisableInboundForMobileNetworks = "InproxyDisableInboundForMobileNetworks"
  457. InproxyDisableIPv6ICECandidates = "InproxyDisableIPv6ICECandidates"
  458. InproxyProxyDisableSTUN = "InproxyProxyDisableSTUN"
  459. InproxyProxyDisablePortMapping = "InproxyProxyDisablePortMapping"
  460. InproxyProxyDisableInboundForMobileNetworks = "InproxyProxyDisableInboundForMobileNetworks"
  461. InproxyProxyDisableIPv6ICECandidates = "InproxyProxyDisableIPv6ICECandidates"
  462. InproxyClientDisableSTUN = "InproxyClientDisableSTUN"
  463. InproxyClientDisablePortMapping = "InproxyClientDisablePortMapping"
  464. InproxyClientDisableInboundForMobileNetworks = "InproxyClientDisableInboundForMobileNetworks"
  465. InproxyClientDisableIPv6ICECandidates = "InproxyClientDisableIPv6ICECandidates"
  466. InproxyProxyDiscoverNATTimeout = "InproxyProxyDiscoverNATTimeout"
  467. InproxyClientDiscoverNATTimeout = "InproxyClientDiscoverNATTimeout"
  468. InproxyWebRTCAnswerTimeout = "InproxyWebRTCAnswerTimeout"
  469. InproxyWebRTCAwaitPortMappingTimeout = "InproxyWebRTCAwaitPortMappingTimeout"
  470. InproxyProxyWebRTCAwaitReadyToProxyTimeout = "InproxyProxyWebRTCAwaitReadyToProxyTimeout"
  471. InproxyClientWebRTCAwaitReadyToProxyTimeout = "InproxyClientWebRTCAwaitReadyToProxyTimeout"
  472. InproxyProxyDestinationDialTimeout = "InproxyProxyDestinationDialTimeout"
  473. InproxyProxyRelayInactivityTimeout = "InproxyProxyRelayInactivityTimeout"
  474. InproxyPsiphonAPIRequestTimeout = "InproxyPsiphonAPIRequestTimeout"
  475. InproxyProxyTotalActivityNoticePeriod = "InproxyProxyTotalActivityNoticePeriod"
  476. InproxyPersonalPairingConnectionWorkerPoolSize = "InproxyPersonalPairingConnectionWorkerPoolSize"
  477. InproxyClientDialRateLimitQuantity = "InproxyClientDialRateLimitQuantity"
  478. InproxyClientDialRateLimitInterval = "InproxyClientDialRateLimitInterval"
  479. InproxyClientNoMatchFailoverProbability = "InproxyClientNoMatchFailoverProbability"
  480. InproxyClientNoMatchFailoverPersonalProbability = "InproxyClientNoMatchFailoverPersonalProbability"
  481. InproxyFrontingProviderClientMaxRequestTimeouts = "InproxyFrontingProviderClientMaxRequestTimeouts"
  482. InproxyFrontingProviderServerMaxRequestTimeouts = "InproxyFrontingProviderServerMaxRequestTimeouts"
  483. InproxyProxyOnBrokerClientFailedRetryPeriod = "InproxyProxyOnBrokerClientFailedRetryPeriod"
  484. InproxyProxyIncompatibleNetworkTypes = "InproxyProxyIncompatibleNetworkTypes"
  485. InproxyClientIncompatibleNetworkTypes = "InproxyClientIncompatibleNetworkTypes"
  486. InproxyReplayRetainFailedProbability = "InproxyReplayRetainFailedProbability"
  487. InproxyProxyDisableWaitToShareSession = "InproxyProxyDisableWaitToShareSession"
  488. InproxyClientDisableWaitToShareSession = "InproxyClientDisableWaitToShareSession"
  489. InproxyTunnelProtocolPreferProbability = "InproxyTunnelProtocolPreferProbability"
  490. InproxyTunnelProtocolForceSelectionCount = "InproxyTunnelProtocolForceSelectionCount"
  491. InproxyEnableProxyQuality = "InproxyEnableProxyQuality"
  492. InproxyEnableProxyQualityClientRegions = "InproxyEnableProxyQualityClientRegions"
  493. InproxyProxyQualityTargetUpstreamBytes = "InproxyProxyQualityTargetUpstreamBytes"
  494. InproxyProxyQualityTargetDownstreamBytes = "InproxyProxyQualityTargetDownstreamBytes"
  495. InproxyProxyQualityTargetDuration = "InproxyProxyQualityTargetDuration"
  496. InproxyProxyQualityReporterTrustedCACertificates = "InproxyProxyQualityReporterTrustedCACertificates"
  497. InproxyProxyQualityReporterAdditionalHeaders = "InproxyProxyQualityReporterAdditionalHeaders"
  498. InproxyProxyQualityReporterMaxRequestEntries = "InproxyProxyQualityReporterMaxRequestEntries"
  499. InproxyProxyQualityReporterRequestDelay = "InproxyProxyQualityReporterRequestDelay"
  500. InproxyProxyQualityReporterRequestTimeout = "InproxyProxyQualityReporterRequestTimeout"
  501. InproxyProxyQualityReporterRequestRetries = "InproxyProxyQualityReporterRequestRetries"
  502. InproxyProxyQualityTTL = "InproxyProxyQualityTTL"
  503. InproxyProxyQualityPendingFailedMatchDeadline = "InproxyProxyQualityPendingFailedMatchDeadline"
  504. InproxyProxyQualityFailedMatchThreshold = "InproxyProxyQualityFailedMatchThreshold"
  505. NetworkIDCacheTTL = "NetworkIDCacheTTL"
  506. ServerDNSResolverCacheMaxSize = "ServerDNSResolverCacheMaxSize"
  507. ServerDNSResolverCacheTTL = "ServerDNSResolverCacheTTL"
  508. CheckServerEntryTagsEnabled = "CheckServerEntryTagsEnabled"
  509. CheckServerEntryTagsPeriod = "CheckServerEntryTagsPeriod"
  510. CheckServerEntryTagsRepeatRatio = "CheckServerEntryTagsRepeatRatio"
  511. CheckServerEntryTagsRepeatMinimum = "CheckServerEntryTagsRepeatMinimum"
  512. CheckServerEntryTagsMaxSendBytes = "CheckServerEntryTagsMaxSendBytes"
  513. CheckServerEntryTagsMaxWorkTime = "CheckServerEntryTagsMaxWorkTime"
  514. ServerEntryPruneDialPortNumberZero = "ServerEntryPruneDialPortNumberZero"
  515. CompressTactics = "CompressTactics"
  516. DSLRelayServiceAddress = "DSLRelayServiceAddress"
  517. DSLRelayMaxHttpConns = "DSLRelayMaxHttpConns"
  518. DSLRelayMaxHttpIdleConns = "DSLRelayMaxHttpIdleConns"
  519. DSLRelayHttpIdleConnTimeout = "DSLRelayHttpIdleConnTimeout"
  520. DSLRelayRequestTimeout = "DSLRelayRequestTimeout"
  521. DSLRelayRetryCount = "DSLRelayRetryCount"
  522. DSLRelayCacheTTL = "DSLRelayCacheTTL"
  523. DSLRelayCacheMaxSize = "DSLRelayCacheMaxSize"
  524. EnableDSLFetcher = "EnableDSLFetcher"
  525. DSLFetcherTunneledRequestTimeout = "DSLFetcherTunneledRequestTimeout"
  526. DSLFetcherTunneledRequestRetryCount = "DSLFetcherTunneledRequestRetryCount"
  527. DSLFetcherTunneledRequestRetryDelay = "DSLFetcherTunneledRequestRetryDelay"
  528. DSLFetcherTunneledRequestRetryDelayJitter = "DSLFetcherTunneledRequestRetryDelayJitter"
  529. DSLFetcherTunneledFetchTTL = "DSLFetcherTunneledFetchTTL"
  530. DSLFetcherTunneledDiscoverServerEntriesMinCount = "DSLFetcherTunneledDiscoverServerEntriesMinCount"
  531. DSLFetcherTunneledDiscoverServerEntriesMaxCount = "DSLFetcherTunneledDiscoverServerEntriesMaxCount"
  532. DSLFetcherTunneledGetServerEntriesMinCount = "DSLFetcherTunneledGetServerEntriesMinCount"
  533. DSLFetcherTunneledGetServerEntriesMaxCount = "DSLFetcherTunneledGetServerEntriesMaxCount"
  534. DSLFetcherUntunneledRequestTimeout = "DSLFetcherUntunneledRequestTimeout"
  535. DSLFetcherUntunneledRequestRetryCount = "DSLFetcherUntunneledRequestRetryCount"
  536. DSLFetcherUntunneledRequestRetryDelay = "DSLFetcherUntunneledRequestRetryDelay"
  537. DSLFetcherUntunneledRequestRetryDelayJitter = "DSLFetcherUntunneledRequestRetryDelayJitter"
  538. DSLFetcherUntunneledFetchTTL = "DSLFetcherUntunneledFetchTTL"
  539. DSLFetcherUntunneledDiscoverServerEntriesMinCount = "DSLFetcherUntunneledDiscoverServerEntriesMinCount"
  540. DSLFetcherUntunneledDiscoverServerEntriesMaxCount = "DSLFetcherUntunneledDiscoverServerEntriesMaxCount"
  541. DSLFetcherUntunneledGetServerEntriesMinCount = "DSLFetcherUntunneledGetServerEntriesMinCount"
  542. DSLFetcherUntunneledGetServerEntriesMaxCount = "DSLFetcherUntunneledGetServerEntriesMaxCount"
  543. DSLFetcherGetLastActiveOSLsTTL = "DSLFetcherGetLastActiveOSLsTTL"
  544. DSLFetcherGetOSLFileSpecsMinCount = "DSLFetcherGetOSLFileSpecsMinCount"
  545. DSLFetcherGetOSLFileSpecsMaxCount = "DSLFetcherGetOSLFileSpecsMaxCount"
  546. // Retired parameters
  547. ReplayRandomizedTLSProfile = "ReplayRandomizedTLSProfile"
  548. InproxyAllBrokerPublicKeys = "InproxyAllBrokerPublicKeys"
  549. InproxyTunnelProtocolSelectionProbability = "InproxyTunnelProtocolSelectionProbability"
  550. )
  551. const (
  552. useNetworkLatencyMultiplier = 1
  553. serverSideOnly = 2
  554. )
  555. // defaultParameters specifies the type, default value, and minimum value for
  556. // all dynamically configurable client and server parameters.
  557. //
  558. // Do not change the names or types of existing values, as that can break
  559. // client logic or cause parameters to not be applied.
  560. //
  561. // Minimum values are a fail-safe for cases where lower values would break the
  562. // client logic. For example, setting a ConnectionWorkerPoolSize of 0 would
  563. // make the client never connect.
  564. var defaultParameters = map[string]struct {
  565. value interface{}
  566. minimum interface{}
  567. flags int32
  568. }{
  569. // NetworkLatencyMultiplier defaults to 0, meaning off. But when set, it
  570. // must be a multiplier >= 1.
  571. NetworkLatencyMultiplier: {value: 0.0, minimum: 1.0},
  572. NetworkLatencyMultiplierMin: {value: 1.0, minimum: 1.0},
  573. NetworkLatencyMultiplierMax: {value: 3.0, minimum: 1.0},
  574. NetworkLatencyMultiplierLambda: {value: 2.0, minimum: 0.001},
  575. TacticsWaitPeriod: {value: 10 * time.Second, minimum: 0 * time.Second, flags: useNetworkLatencyMultiplier},
  576. TacticsRetryPeriod: {value: 5 * time.Second, minimum: 1 * time.Millisecond},
  577. TacticsRetryPeriodJitter: {value: 0.3, minimum: 0.0},
  578. TacticsTimeout: {value: 2 * time.Minute, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  579. ConnectionWorkerPoolSize: {value: 10, minimum: 1},
  580. TunnelPoolSize: {value: 1, minimum: 1},
  581. TunnelConnectTimeout: {value: 20 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  582. EstablishTunnelTimeout: {value: 300 * time.Second, minimum: time.Duration(0)},
  583. EstablishTunnelWorkTime: {value: 60 * time.Second, minimum: 1 * time.Second},
  584. EstablishTunnelPausePeriod: {value: 5 * time.Second, minimum: 1 * time.Millisecond},
  585. EstablishTunnelPausePeriodJitter: {value: 0.1, minimum: 0.0},
  586. EstablishTunnelServerAffinityGracePeriod: {value: 1 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  587. StaggerConnectionWorkersPeriod: {value: time.Duration(0), minimum: time.Duration(0)},
  588. StaggerConnectionWorkersJitter: {value: 0.1, minimum: 0.0},
  589. LimitIntensiveConnectionWorkers: {value: 0, minimum: 0},
  590. UpstreamProxyErrorMinWaitDuration: {value: 10 * time.Second, minimum: time.Duration(0)},
  591. UpstreamProxyErrorMaxWaitDuration: {value: 30 * time.Second, minimum: time.Duration(0)},
  592. IgnoreHandshakeStatsRegexps: {value: false},
  593. TunnelOperateShutdownTimeout: {value: 1 * time.Second, minimum: 1 * time.Millisecond, flags: useNetworkLatencyMultiplier},
  594. TunnelPortForwardDialTimeout: {value: 10 * time.Second, minimum: 1 * time.Millisecond, flags: useNetworkLatencyMultiplier},
  595. PacketTunnelReadTimeout: {value: 10 * time.Second, minimum: 1 * time.Millisecond, flags: useNetworkLatencyMultiplier},
  596. TunnelRateLimits: {value: common.RateLimits{}},
  597. // PrioritizeTunnelProtocols parameters are obsoleted by InitialLimitTunnelProtocols.
  598. // TODO: remove once no longer required for older clients.
  599. PrioritizeTunnelProtocolsProbability: {value: 1.0, minimum: 0.0},
  600. PrioritizeTunnelProtocols: {value: protocol.TunnelProtocols{}},
  601. PrioritizeTunnelProtocolsCandidateCount: {value: 10, minimum: 0},
  602. InitialLimitTunnelProtocolsProbability: {value: 1.0, minimum: 0.0},
  603. InitialLimitTunnelProtocols: {value: protocol.TunnelProtocols{}},
  604. InitialLimitTunnelProtocolsCandidateCount: {value: 0, minimum: 0},
  605. LimitTunnelProtocolsProbability: {value: 1.0, minimum: 0.0},
  606. LimitTunnelProtocols: {value: protocol.TunnelProtocols{}},
  607. LimitTunnelDialPortNumbersProbability: {value: 1.0, minimum: 0.0},
  608. LimitTunnelDialPortNumbers: {value: TunnelProtocolPortLists{}},
  609. LimitTLSProfilesProbability: {value: 1.0, minimum: 0.0},
  610. LimitTLSProfiles: {value: protocol.TLSProfiles{}},
  611. UseOnlyCustomTLSProfiles: {value: false},
  612. CustomTLSProfiles: {value: protocol.CustomTLSProfiles{}},
  613. SelectRandomizedTLSProfileProbability: {value: 0.25, minimum: 0.0},
  614. NoDefaultTLSSessionIDProbability: {value: 0.5, minimum: 0.0},
  615. DisableFrontingProviderTLSProfiles: {value: protocol.LabeledTLSProfiles{}},
  616. LimitQUICVersionsProbability: {value: 1.0, minimum: 0.0},
  617. LimitQUICVersions: {value: protocol.QUICVersions{}},
  618. DisableFrontingProviderQUICVersions: {value: protocol.LabeledQUICVersions{}},
  619. QUICDialEarlyProbability: {value: 1.0, minimum: 0.0},
  620. QUICObfuscatedPSKProbability: {value: 0.5, minimum: 0.0},
  621. QUICDisableClientPathMTUDiscoveryProbability: {value: 0.0, minimum: 0.0},
  622. FragmentorProbability: {value: 0.5, minimum: 0.0},
  623. FragmentorLimitProtocols: {value: protocol.TunnelProtocols{}},
  624. FragmentorMinTotalBytes: {value: 0, minimum: 0},
  625. FragmentorMaxTotalBytes: {value: 0, minimum: 0},
  626. FragmentorMinWriteBytes: {value: 1, minimum: 1},
  627. FragmentorMaxWriteBytes: {value: 1500, minimum: 1},
  628. FragmentorMinDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  629. FragmentorMaxDelay: {value: 10 * time.Millisecond, minimum: time.Duration(0)},
  630. FragmentorDownstreamProbability: {value: 0.5, minimum: 0.0, flags: serverSideOnly},
  631. FragmentorDownstreamLimitProtocols: {value: protocol.TunnelProtocols{}, flags: serverSideOnly},
  632. FragmentorDownstreamMinTotalBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  633. FragmentorDownstreamMaxTotalBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  634. FragmentorDownstreamMinWriteBytes: {value: 1, minimum: 1, flags: serverSideOnly},
  635. FragmentorDownstreamMaxWriteBytes: {value: 1500, minimum: 1, flags: serverSideOnly},
  636. FragmentorDownstreamMinDelay: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  637. FragmentorDownstreamMaxDelay: {value: 10 * time.Millisecond, minimum: time.Duration(0), flags: serverSideOnly},
  638. // The Psiphon server will reject obfuscated SSH seed messages with
  639. // padding greater than OBFUSCATE_MAX_PADDING.
  640. // obfuscator.NewClientObfuscator will ignore invalid min/max padding
  641. // configurations.
  642. ObfuscatedSSHMinPadding: {value: 0, minimum: 0},
  643. ObfuscatedSSHMaxPadding: {value: obfuscator.OBFUSCATE_MAX_PADDING, minimum: 0},
  644. AdditionalCustomHeaders: {value: make(http.Header)},
  645. // Speed test and SSH keep alive padding is intended to frustrate
  646. // fingerprinting and should not exceed ~1 IP packet size.
  647. //
  648. // Currently, each serialized speed test sample, populated with real
  649. // values, is approximately 100 bytes. All SpeedTestMaxSampleCount samples
  650. // are loaded into memory are sent as API inputs.
  651. SpeedTestPaddingMinBytes: {value: 0, minimum: 0},
  652. SpeedTestPaddingMaxBytes: {value: 256, minimum: 0},
  653. SpeedTestMaxSampleCount: {value: 5, minimum: 1},
  654. // The Psiphon server times out inactive tunnels after 5 minutes, so this
  655. // is a soft max for SSHKeepAlivePeriodMax.
  656. SSHKeepAliveSpeedTestSampleProbability: {value: 0.5, minimum: 0.0},
  657. SSHKeepAlivePaddingMinBytes: {value: 0, minimum: 0},
  658. SSHKeepAlivePaddingMaxBytes: {value: 256, minimum: 0},
  659. SSHKeepAlivePeriodMin: {value: 1 * time.Minute, minimum: 1 * time.Second},
  660. SSHKeepAlivePeriodMax: {value: 2 * time.Minute, minimum: 1 * time.Second},
  661. SSHKeepAlivePeriodicTimeout: {value: 30 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  662. SSHKeepAlivePeriodicInactivePeriod: {value: 10 * time.Second, minimum: 1 * time.Second},
  663. SSHKeepAliveProbeTimeout: {value: 5 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  664. SSHKeepAliveProbeInactivePeriod: {value: 10 * time.Second, minimum: 1 * time.Second},
  665. SSHKeepAliveNetworkConnectivityPollingPeriod: {value: 500 * time.Millisecond, minimum: 1 * time.Millisecond},
  666. SSHKeepAliveResetOnFailureProbability: {value: 0.0, minimum: 0.0},
  667. HTTPProxyOriginServerTimeout: {value: 15 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  668. HTTPProxyMaxIdleConnectionsPerHost: {value: 50, minimum: 0},
  669. FetchRemoteServerListTimeout: {value: 30 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  670. FetchRemoteServerListRetryPeriod: {value: 30 * time.Second, minimum: 1 * time.Millisecond},
  671. FetchRemoteServerListStalePeriod: {value: 6 * time.Hour, minimum: 1 * time.Hour},
  672. RemoteServerListSignaturePublicKey: {value: ""},
  673. RemoteServerListURLs: {value: TransferURLs{}},
  674. ObfuscatedServerListRootURLs: {value: TransferURLs{}},
  675. PsiphonAPIRequestTimeout: {value: 10 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  676. PsiphonAPIStatusRequestPeriodMin: {value: 5 * time.Minute, minimum: 1 * time.Second},
  677. PsiphonAPIStatusRequestPeriodMax: {value: 10 * time.Minute, minimum: 1 * time.Second},
  678. PsiphonAPIStatusRequestShortPeriodMin: {value: 5 * time.Second, minimum: 1 * time.Second},
  679. PsiphonAPIStatusRequestShortPeriodMax: {value: 10 * time.Second, minimum: 1 * time.Second},
  680. // PsiphonAPIPersistentStatsMaxCount parameter is obsoleted by PersistentStatsMaxSendBytes.
  681. // TODO: remove once no longer required for older clients.
  682. PsiphonAPIPersistentStatsMaxCount: {value: 100, minimum: 1},
  683. // PsiphonAPIStatusRequestPadding parameters are obsoleted by APIRequestUp/DownstreamPadding.
  684. // TODO: remove once no longer required for older clients.
  685. PsiphonAPIStatusRequestPaddingMinBytes: {value: 0, minimum: 0},
  686. PsiphonAPIStatusRequestPaddingMaxBytes: {value: 256, minimum: 0},
  687. PsiphonAPIConnectedRequestRetryPeriod: {value: 5 * time.Second, minimum: 1 * time.Millisecond},
  688. // FetchSplitTunnelRoutesTimeout, SplitTunnelRoutesURLFormat,
  689. // SplitTunnelRoutesSignaturePublicKey and SplitTunnelDNSServer are obsoleted
  690. // by the server-assisted split tunnel implementation.
  691. // TODO: remove once no longer required for older clients.
  692. FetchSplitTunnelRoutesTimeout: {value: 60 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  693. SplitTunnelRoutesURLFormat: {value: ""},
  694. SplitTunnelRoutesSignaturePublicKey: {value: ""},
  695. SplitTunnelDNSServer: {value: ""},
  696. SplitTunnelClassificationTTL: {value: 24 * time.Hour, minimum: 0 * time.Second},
  697. SplitTunnelClassificationMaxEntries: {value: 65536, minimum: 0},
  698. FetchUpgradeTimeout: {value: 60 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  699. FetchUpgradeRetryPeriod: {value: 30 * time.Second, minimum: 1 * time.Millisecond},
  700. FetchUpgradeStalePeriod: {value: 6 * time.Hour, minimum: 1 * time.Hour},
  701. UpgradeDownloadURLs: {value: TransferURLs{}},
  702. UpgradeDownloadClientVersionHeader: {value: ""},
  703. TotalBytesTransferredNoticePeriod: {value: 5 * time.Minute, minimum: 1 * time.Second},
  704. TotalBytesTransferredEmitMemoryMetrics: {value: true},
  705. // The meek server times out inactive sessions after 45 seconds, so this
  706. // is a soft max for MeekMaxPollInterval, MeekRoundTripTimeout, and
  707. // MeekRoundTripRetryDeadline.
  708. //
  709. // MeekCookieMaxPadding cannot exceed common.OBFUSCATE_SEED_LENGTH.
  710. //
  711. // MeekMinTLSPadding/MeekMaxTLSPadding are subject to TLS server limitations.
  712. //
  713. // MeekMinLimitRequestPayloadLength/MeekMaxLimitRequestPayloadLength
  714. // cannot exceed server.MEEK_MAX_REQUEST_PAYLOAD_LENGTH.
  715. MeekDialDomainsOnly: {value: false},
  716. MeekLimitBufferSizes: {value: false},
  717. MeekCookieMaxPadding: {value: 256, minimum: 0},
  718. MeekFullReceiveBufferLength: {value: 4194304, minimum: 1024},
  719. MeekReadPayloadChunkLength: {value: 65536, minimum: 1024},
  720. MeekLimitedFullReceiveBufferLength: {value: 131072, minimum: 1024},
  721. MeekLimitedReadPayloadChunkLength: {value: 4096, minimum: 1024},
  722. MeekMinPollInterval: {value: 100 * time.Millisecond, minimum: 1 * time.Millisecond},
  723. MeekMinPollIntervalJitter: {value: 0.3, minimum: 0.0},
  724. MeekMaxPollInterval: {value: 5 * time.Second, minimum: 1 * time.Millisecond},
  725. MeekMaxPollIntervalJitter: {value: 0.1, minimum: 0.0},
  726. MeekPollIntervalMultiplier: {value: 1.5, minimum: 0.0},
  727. MeekPollIntervalJitter: {value: 0.1, minimum: 0.0},
  728. MeekApplyPollIntervalMultiplierProbability: {value: 0.5},
  729. MeekRoundTripRetryDeadline: {value: 5 * time.Second, minimum: 1 * time.Millisecond, flags: useNetworkLatencyMultiplier},
  730. MeekRoundTripRetryMinDelay: {value: 50 * time.Millisecond, minimum: time.Duration(0)},
  731. MeekRoundTripRetryMaxDelay: {value: 1 * time.Second, minimum: time.Duration(0)},
  732. MeekRoundTripRetryMultiplier: {value: 2.0, minimum: 0.0},
  733. MeekRoundTripTimeout: {value: 20 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  734. MeekTrafficShapingProbability: {value: 1.0, minimum: 0.0},
  735. MeekTrafficShapingLimitProtocols: {value: protocol.TunnelProtocols{}},
  736. MeekMinTLSPadding: {value: 0, minimum: 0},
  737. MeekMaxTLSPadding: {value: 0, minimum: 0},
  738. MeekMinLimitRequestPayloadLength: {value: 65536, minimum: 1},
  739. MeekMaxLimitRequestPayloadLength: {value: 65536, minimum: 1},
  740. MeekRedialTLSProbability: {value: 0.0, minimum: 0.0},
  741. MeekAlternateCookieNameProbability: {value: 0.5, minimum: 0.0},
  742. MeekAlternateContentTypeProbability: {value: 0.5, minimum: 0.0},
  743. TransformHostNameProbability: {value: 0.5, minimum: 0.0},
  744. PickUserAgentProbability: {value: 0.5, minimum: 0.0},
  745. InitialLivenessTest: {value: make(LivenessTestSpecs)},
  746. LivenessTest: {value: make(LivenessTestSpecs)},
  747. LivenessTestMinUpstreamBytes: {value: 0, minimum: 0},
  748. LivenessTestMaxUpstreamBytes: {value: 0, minimum: 0},
  749. LivenessTestMinDownstreamBytes: {value: 0, minimum: 0},
  750. LivenessTestMaxDownstreamBytes: {value: 0, minimum: 0},
  751. ReplayCandidateCount: {value: 10, minimum: -1},
  752. ReplayDialParametersTTL: {value: 24 * time.Hour, minimum: time.Duration(0)},
  753. ReplayTargetUpstreamBytes: {value: 0, minimum: 0},
  754. ReplayTargetDownstreamBytes: {value: 0, minimum: 0},
  755. ReplayTargetTunnelDuration: {value: 1 * time.Second, minimum: time.Duration(0)},
  756. ReplayLaterRoundMoveToFrontProbability: {value: 0.0, minimum: 0.0},
  757. ReplayRetainFailedProbability: {value: 0.5, minimum: 0.0},
  758. ReplayIgnoreChangedConfigState: {value: false},
  759. ReplayBPF: {value: true},
  760. ReplaySSH: {value: true},
  761. ReplayObfuscatorPadding: {value: true},
  762. ReplayFragmentor: {value: true},
  763. ReplayTLSProfile: {value: true},
  764. ReplayFronting: {value: true},
  765. ReplayHostname: {value: true},
  766. ReplayQUICVersion: {value: true},
  767. ReplayObfuscatedQUIC: {value: true},
  768. ReplayObfuscatedQUICNonceTransformer: {value: true},
  769. ReplayConjureRegistration: {value: true},
  770. ReplayConjureTransport: {value: true},
  771. ReplayLivenessTest: {value: true},
  772. ReplayUserAgent: {value: true},
  773. ReplayAPIRequestPadding: {value: true},
  774. ReplayHoldOffTunnel: {value: true},
  775. ReplayResolveParameters: {value: true},
  776. ReplayHTTPTransformerParameters: {value: true},
  777. ReplayOSSHSeedTransformerParameters: {value: true},
  778. ReplayOSSHPrefix: {value: true},
  779. ReplayShadowsocksPrefix: {value: true},
  780. ReplayTLSFragmentClientHello: {value: true},
  781. ReplayInproxyWebRTC: {value: true},
  782. ReplayInproxySTUN: {value: true},
  783. APIRequestUpstreamPaddingMinBytes: {value: 0, minimum: 0},
  784. APIRequestUpstreamPaddingMaxBytes: {value: 1024, minimum: 0},
  785. APIRequestDownstreamPaddingMinBytes: {value: 0, minimum: 0},
  786. APIRequestDownstreamPaddingMaxBytes: {value: 1024, minimum: 0},
  787. PersistentStatsMaxStoreRecords: {value: 200, minimum: 1},
  788. PersistentStatsMaxSendBytes: {value: 65536, minimum: 1},
  789. RecordRemoteServerListPersistentStatsProbability: {value: 1.0, minimum: 0.0},
  790. RecordFailedTunnelPersistentStatsProbability: {value: 0.0, minimum: 0.0},
  791. ServerEntryMinimumAgeForPruning: {value: 7 * 24 * time.Hour, minimum: 24 * time.Hour},
  792. ApplicationParameters: {value: KeyValues{}},
  793. BPFServerTCPProgram: {value: (*BPFProgramSpec)(nil), flags: serverSideOnly},
  794. BPFServerTCPProbability: {value: 0.5, minimum: 0.0, flags: serverSideOnly},
  795. BPFClientTCPProgram: {value: (*BPFProgramSpec)(nil)},
  796. BPFClientTCPProbability: {value: 0.5, minimum: 0.0},
  797. ServerPacketManipulationSpecs: {value: PacketManipulationSpecs{}, flags: serverSideOnly},
  798. ServerProtocolPacketManipulations: {value: make(ProtocolPacketManipulations), flags: serverSideOnly},
  799. ServerPacketManipulationProbability: {value: 0.5, minimum: 0.0, flags: serverSideOnly},
  800. FeedbackUploadURLs: {value: TransferURLs{}},
  801. FeedbackEncryptionPublicKey: {value: ""},
  802. FeedbackTacticsWaitPeriod: {value: 5 * time.Second, minimum: 0 * time.Second, flags: useNetworkLatencyMultiplier},
  803. FeedbackUploadMaxAttempts: {value: 5, minimum: 0},
  804. // TODO: rename -- remove "Seconds" suffix
  805. FeedbackUploadRetryMinDelaySeconds: {value: 1 * time.Minute, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  806. FeedbackUploadRetryMaxDelaySeconds: {value: 5 * time.Minute, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  807. FeedbackUploadTimeoutSeconds: {value: 30 * time.Second, minimum: 0 * time.Second, flags: useNetworkLatencyMultiplier},
  808. ServerReplayPacketManipulation: {value: true, flags: serverSideOnly},
  809. ServerReplayFragmentor: {value: true, flags: serverSideOnly},
  810. ServerReplayUnknownGeoIP: {value: false, flags: serverSideOnly},
  811. ServerReplayTTL: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  812. ServerReplayTargetWaitDuration: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  813. ServerReplayTargetTunnelDuration: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  814. ServerReplayTargetUpstreamBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  815. ServerReplayTargetDownstreamBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  816. ServerReplayFailedCountThreshold: {value: 0, minimum: 0, flags: serverSideOnly},
  817. ServerBurstUpstreamTargetBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  818. ServerBurstUpstreamDeadline: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  819. ServerBurstDownstreamTargetBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  820. ServerBurstDownstreamDeadline: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  821. ClientBurstUpstreamTargetBytes: {value: 0, minimum: 0},
  822. ClientBurstUpstreamDeadline: {value: time.Duration(0), minimum: time.Duration(0)},
  823. ClientBurstDownstreamTargetBytes: {value: 0, minimum: 0},
  824. ClientBurstDownstreamDeadline: {value: time.Duration(0), minimum: time.Duration(0)},
  825. ConjureCachedRegistrationTTL: {value: time.Duration(0), minimum: time.Duration(0)},
  826. // ConjureAPIRegistrarURL parameter is obsoleted by ConjureAPIRegistrarBidirectionalURL.
  827. // TODO: remove once no longer required for older clients.
  828. ConjureAPIRegistrarURL: {value: ""},
  829. ConjureAPIRegistrarBidirectionalURL: {value: ""},
  830. ConjureAPIRegistrarFrontingSpecs: {value: FrontingSpecs{}},
  831. ConjureAPIRegistrarMinDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  832. ConjureAPIRegistrarMaxDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  833. ConjureDecoyRegistrarProbability: {value: 0.0, minimum: 0.0},
  834. ConjureDecoyRegistrarWidth: {value: 5, minimum: 0},
  835. ConjureDecoyRegistrarMinDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  836. ConjureDecoyRegistrarMaxDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  837. ConjureEnableIPv6Dials: {value: true},
  838. ConjureEnablePortRandomization: {value: true},
  839. ConjureEnableRegistrationOverrides: {value: false},
  840. ConjureLimitTransportsProbability: {value: 1.0, minimum: 0.0},
  841. ConjureLimitTransports: {value: protocol.ConjureTransports{}},
  842. ConjureSTUNServerAddresses: {value: []string{}},
  843. ConjureDTLSEmptyInitialPacketProbability: {value: 0.0, minimum: 0.0},
  844. CustomHostNameRegexes: {value: RegexStrings{}},
  845. CustomHostNameProbability: {value: 0.0, minimum: 0.0},
  846. CustomHostNameLimitProtocols: {value: protocol.TunnelProtocols{}},
  847. HoldOffTunnelMinDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  848. HoldOffTunnelMaxDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  849. HoldOffTunnelProtocols: {value: protocol.TunnelProtocols{}},
  850. HoldOffTunnelFrontingProviderIDs: {value: []string{}},
  851. HoldOffTunnelProbability: {value: 0.0, minimum: 0.0},
  852. HoldOffTunnelProtocolMinDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  853. HoldOffTunnelProtocolMaxDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  854. HoldOffTunnelProtocolNames: {value: protocol.TunnelProtocols{}},
  855. HoldOffTunnelProtocolProbability: {value: 0.0, minimum: 0.0},
  856. HoldOffFrontingTunnelMinDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  857. HoldOffFrontingTunnelMaxDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  858. HoldOffFrontingTunnelProviderIDs: {value: []string{}},
  859. HoldOffFrontingTunnelProbability: {value: 0.0, minimum: 0.0},
  860. RestrictFrontingProviderIDs: {value: []string{}},
  861. RestrictFrontingProviderIDsServerProbability: {value: 0.0, minimum: 0.0, flags: serverSideOnly},
  862. RestrictFrontingProviderIDsClientProbability: {value: 0.0, minimum: 0.0},
  863. HoldOffDirectTunnelMinDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  864. HoldOffDirectTunnelMaxDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  865. HoldOffDirectTunnelProviderRegions: {value: KeyStrings{}},
  866. HoldOffDirectTunnelProbability: {value: 0.0, minimum: 0.0},
  867. RestrictDirectProviderRegions: {value: KeyStrings{}},
  868. RestrictDirectProviderIDsServerProbability: {value: 0.0, minimum: 0.0, flags: serverSideOnly},
  869. RestrictDirectProviderIDsClientProbability: {value: 0.0, minimum: 0.0},
  870. HoldOffInproxyTunnelMinDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  871. HoldOffInproxyTunnelMaxDuration: {value: time.Duration(0), minimum: time.Duration(0)},
  872. HoldOffInproxyTunnelProviderRegions: {value: KeyStrings{}},
  873. HoldOffInproxyTunnelProbability: {value: 0.0, minimum: 0.0},
  874. RestrictInproxyProviderRegions: {value: KeyStrings{}},
  875. RestrictInproxyProviderIDsServerProbability: {value: 0.0, minimum: 0.0, flags: serverSideOnly},
  876. RestrictInproxyProviderIDsClientProbability: {value: 0.0, minimum: 0.0},
  877. UpstreamProxyAllowAllServerEntrySources: {value: false},
  878. DestinationBytesMetricsASN: {value: "", flags: serverSideOnly},
  879. DestinationBytesMetricsASNs: {value: []string{}, flags: serverSideOnly},
  880. DNSResolverAttemptsPerServer: {value: 2, minimum: 1},
  881. DNSResolverAttemptsPerPreferredServer: {value: 1, minimum: 1},
  882. DNSResolverRequestTimeout: {value: 5 * time.Second, minimum: 100 * time.Millisecond, flags: useNetworkLatencyMultiplier},
  883. DNSResolverAwaitTimeout: {value: 10 * time.Millisecond, minimum: 1 * time.Millisecond, flags: useNetworkLatencyMultiplier},
  884. DNSResolverPreresolvedIPAddressCIDRs: {value: LabeledCIDRs{}},
  885. DNSResolverPreresolvedIPAddressProbability: {value: 0.0, minimum: 0.0},
  886. DNSResolverAlternateServers: {value: []string{}},
  887. DNSResolverPreferredAlternateServers: {value: []string{}},
  888. DNSResolverPreferAlternateServerProbability: {value: 0.0, minimum: 0.0},
  889. DNSResolverProtocolTransformSpecs: {value: transforms.Specs{}},
  890. DNSResolverProtocolTransformScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  891. DNSResolverProtocolTransformProbability: {value: 0.0, minimum: 0.0},
  892. DNSResolverIncludeEDNS0Probability: {value: 0.0, minimum: 0.0},
  893. DNSResolverCacheExtensionInitialTTL: {value: time.Duration(0), minimum: time.Duration(0)},
  894. DNSResolverCacheExtensionVerifiedTTL: {value: time.Duration(0), minimum: time.Duration(0)},
  895. DNSResolverQNameRandomizeCasingProbability: {value: 0.0, minimum: 0.0},
  896. DNSResolverQNameMustMatchProbability: {value: 0.0, minimum: 0.0},
  897. AddFrontingProviderPsiphonFrontingHeader: {value: protocol.LabeledTunnelProtocols{}},
  898. DirectHTTPProtocolTransformSpecs: {value: transforms.Specs{}},
  899. DirectHTTPProtocolTransformScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  900. DirectHTTPProtocolTransformProbability: {value: 0.0, minimum: 0.0},
  901. FrontedHTTPProtocolTransformSpecs: {value: transforms.Specs{}},
  902. FrontedHTTPProtocolTransformScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  903. FrontedHTTPProtocolTransformProbability: {value: 0.0, minimum: 0.0},
  904. OSSHObfuscatorSeedTransformSpecs: {value: transforms.Specs{}},
  905. OSSHObfuscatorSeedTransformScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  906. OSSHObfuscatorSeedTransformProbability: {value: 0.0, minimum: 0.0},
  907. ObfuscatedQUICNonceTransformSpecs: {value: transforms.Specs{}},
  908. ObfuscatedQUICNonceTransformScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  909. ObfuscatedQUICNonceTransformProbability: {value: 0.0, minimum: 0.0},
  910. OSSHPrefixSpecs: {value: transforms.Specs{}},
  911. OSSHPrefixScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  912. OSSHPrefixProbability: {value: 0.0, minimum: 0.0},
  913. OSSHPrefixSplitMinDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  914. OSSHPrefixSplitMaxDelay: {value: time.Duration(0), minimum: time.Duration(0)},
  915. OSSHPrefixEnableFragmentor: {value: false},
  916. ServerOSSHPrefixSpecs: {value: transforms.Specs{}, flags: serverSideOnly},
  917. ShadowsocksPrefixSpecs: {value: transforms.Specs{}},
  918. ShadowsocksPrefixScopedSpecNames: {value: transforms.ScopedSpecNames{}},
  919. ShadowsocksPrefixProbability: {value: 0.0, minimum: 0.0},
  920. // TLSTunnelMinTLSPadding/TLSTunnelMaxTLSPadding are subject to TLS server limitations.
  921. TLSTunnelObfuscatedPSKProbability: {value: 0.5, minimum: 0.0},
  922. TLSTunnelTrafficShapingProbability: {value: 1.0, minimum: 0.0},
  923. TLSTunnelMinTLSPadding: {value: 0, minimum: 0},
  924. TLSTunnelMaxTLSPadding: {value: 0, minimum: 0},
  925. TLSFragmentClientHelloProbability: {value: 0.0, minimum: 0.0},
  926. TLSFragmentClientHelloLimitProtocols: {value: protocol.TunnelProtocols{}},
  927. SteeringIPCacheTTL: {value: 1 * time.Hour, minimum: time.Duration(0)},
  928. SteeringIPCacheMaxEntries: {value: 65536, minimum: 0},
  929. SteeringIPProbability: {value: 1.0, minimum: 0.0},
  930. ServerDiscoveryStrategy: {value: "", flags: serverSideOnly},
  931. FrontedHTTPClientReplayDialParametersTTL: {value: 24 * time.Hour, minimum: time.Duration(0)},
  932. FrontedHTTPClientReplayUpdateFrequency: {value: 5 * time.Minute, minimum: time.Duration(0)},
  933. FrontedHTTPClientReplayDialParametersProbability: {value: 1.0, minimum: 0.0},
  934. FrontedHTTPClientReplayRetainFailedProbability: {value: 0.5, minimum: 0.0},
  935. // For inproxy tactics, there is no proxyOnly flag, since Psiphon apps may
  936. // run both clients and inproxy proxies.
  937. //
  938. // Note: useNetworkLatencyMultiplier is not applied to request timeouts
  939. // since timeouts are strictly enforced on the broker server-side.
  940. InproxyAllowProxy: {value: false},
  941. InproxyAllowClient: {value: false, flags: serverSideOnly},
  942. InproxyAllowDomainFrontedDestinations: {value: false, flags: serverSideOnly},
  943. InproxyAllowMatchByRegion: {value: KeyStrings{}, flags: serverSideOnly},
  944. InproxyAllowMatchByASN: {value: KeyStrings{}, flags: serverSideOnly},
  945. InproxyDisallowMatchByRegion: {value: KeyStrings{}, flags: serverSideOnly},
  946. InproxyDisallowMatchByASN: {value: KeyStrings{}, flags: serverSideOnly},
  947. InproxyTunnelProtocolSelectionProbability: {value: 1.0, minimum: 0.0},
  948. InproxyAllBrokerPublicKeys: {value: []string{}, flags: serverSideOnly},
  949. InproxyAllBrokerSpecs: {value: InproxyBrokerSpecsValue{}, flags: serverSideOnly},
  950. InproxyBrokerSpecs: {value: InproxyBrokerSpecsValue{}},
  951. InproxyPersonalPairingBrokerSpecs: {value: InproxyBrokerSpecsValue{}},
  952. InproxyProxyBrokerSpecs: {value: InproxyBrokerSpecsValue{}},
  953. InproxyProxyPersonalPairingBrokerSpecs: {value: InproxyBrokerSpecsValue{}},
  954. InproxyClientBrokerSpecs: {value: InproxyBrokerSpecsValue{}},
  955. InproxyClientPersonalPairingBrokerSpecs: {value: InproxyBrokerSpecsValue{}},
  956. InproxyReplayBrokerDialParametersTTL: {value: 24 * time.Hour, minimum: time.Duration(0)},
  957. InproxyReplayBrokerUpdateFrequency: {value: 5 * time.Minute, minimum: time.Duration(0)},
  958. InproxyReplayBrokerDialParametersProbability: {value: 1.0, minimum: 0.0},
  959. InproxyReplayBrokerRetainFailedProbability: {value: 0.5, minimum: 0.0},
  960. InproxyAllCommonCompartmentIDs: {value: []string{}, flags: serverSideOnly},
  961. InproxyCommonCompartmentIDs: {value: InproxyCompartmentIDsValue{}},
  962. InproxyMaxCompartmentIDListLength: {value: 50, minimum: 0},
  963. InproxyBrokerMatcherAnnouncementLimitEntryCount: {value: 50, minimum: 0, flags: serverSideOnly},
  964. InproxyBrokerMatcherAnnouncementRateLimitQuantity: {value: 50, minimum: 0, flags: serverSideOnly},
  965. InproxyBrokerMatcherAnnouncementRateLimitInterval: {value: 1 * time.Minute, minimum: time.Duration(0), flags: serverSideOnly},
  966. InproxyBrokerMatcherAnnouncementNonlimitedProxyIDs: {value: []string{}, flags: serverSideOnly},
  967. InproxyBrokerMatcherOfferLimitEntryCount: {value: 10, minimum: 0, flags: serverSideOnly},
  968. InproxyBrokerMatcherOfferRateLimitQuantity: {value: 50, minimum: 0, flags: serverSideOnly},
  969. InproxyBrokerMatcherOfferRateLimitInterval: {value: 1 * time.Minute, minimum: time.Duration(0), flags: serverSideOnly},
  970. InproxyBrokerMatcherPrioritizeProxiesProbability: {value: 1.0, minimum: 0.0, flags: serverSideOnly},
  971. InproxyBrokerMatcherPrioritizeProxiesFilter: {value: KeyStrings{}, flags: serverSideOnly},
  972. InproxyBrokerMatcherPrioritizeProxiesMinVersion: {value: 0, minimum: 0, flags: serverSideOnly},
  973. InproxyBrokerProxyAnnounceTimeout: {value: 2 * time.Minute, minimum: time.Duration(0), flags: serverSideOnly},
  974. InproxyBrokerClientOfferTimeout: {value: 10 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  975. InproxyBrokerClientOfferPersonalTimeout: {value: 5 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  976. InproxyBrokerPendingServerRequestsTTL: {value: 60 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  977. InproxyBrokerDSLRequestRateLimitQuantity: {value: 20, minimum: 0, flags: serverSideOnly},
  978. InproxyBrokerDSLRequestRateLimitInterval: {value: 1 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  979. InproxySessionHandshakeRoundTripTimeout: {value: 10 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  980. InproxyProxyAnnounceRequestTimeout: {value: 2*time.Minute + 10*time.Second, minimum: time.Duration(0)},
  981. InproxyProxyAnnounceDelay: {value: 100 * time.Millisecond, minimum: time.Duration(0)},
  982. InproxyProxyAnnounceDelayJitter: {value: 0.5, minimum: 0.0},
  983. InproxyProxyAnnounceMaxBackoffDelay: {value: 1 * time.Minute, minimum: time.Duration(0)},
  984. InproxyProxyAnswerRequestTimeout: {value: 10*time.Second + 10*time.Second, minimum: time.Duration(0)},
  985. InproxyClientOfferRequestTimeout: {value: 10*time.Second + 10*time.Second, minimum: time.Duration(0)},
  986. InproxyClientOfferRequestPersonalTimeout: {value: 5*time.Second + 10*time.Second, minimum: time.Duration(0)},
  987. InproxyClientOfferRetryDelay: {value: 100 * time.Millisecond, minimum: time.Duration(0)},
  988. InproxyClientOfferRetryJitter: {value: 0.5, minimum: 0.0},
  989. InproxyClientRelayedPacketRequestTimeout: {value: 35 * time.Second, minimum: time.Duration(0)},
  990. InproxyClientDSLRequestTimeout: {value: 10 * time.Second, minimum: time.Duration(0)},
  991. InproxyBrokerRoundTripStatusCodeFailureThreshold: {value: 2 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  992. InproxyDTLSRandomizationProbability: {value: 0.5, minimum: 0.0},
  993. InproxyWebRTCMediaStreamsProbability: {value: 0.0, minimum: 0.0},
  994. InproxyWebRTCDataChannelTrafficShapingProbability: {value: 0.5, minimum: 0.0},
  995. InproxyWebRTCDataChannelTrafficShapingParameters: {value: InproxyTrafficShapingParametersValue{0, 10, 0, 1500, 0, 10, 1, 1500, 0.5}},
  996. InproxyWebRTCMediaStreamsTrafficShapingProbability: {value: 0.5, minimum: 0.0},
  997. InproxyWebRTCMediaStreamsTrafficShapingParameters: {value: InproxyTrafficShapingParametersValue{0, 10, 0, 254, 0, 10, 1, 1200, 0.5}},
  998. InproxySTUNServerAddresses: {value: []string{}},
  999. InproxySTUNServerAddressesRFC5780: {value: []string{}},
  1000. InproxyProxySTUNServerAddresses: {value: []string{}},
  1001. InproxyProxySTUNServerAddressesRFC5780: {value: []string{}},
  1002. InproxyClientSTUNServerAddresses: {value: []string{}},
  1003. InproxyClientSTUNServerAddressesRFC5780: {value: []string{}},
  1004. InproxyClientDiscoverNATProbability: {value: 0.0, minimum: 0.0},
  1005. InproxyDisableSTUN: {value: false},
  1006. InproxyDisablePortMapping: {value: false},
  1007. InproxyDisableInboundForMobileNetworks: {value: false},
  1008. InproxyDisableIPv6ICECandidates: {value: false},
  1009. InproxyProxyDisableSTUN: {value: false},
  1010. InproxyProxyDisablePortMapping: {value: false},
  1011. InproxyProxyDisableInboundForMobileNetworks: {value: false},
  1012. InproxyProxyDisableIPv6ICECandidates: {value: false},
  1013. InproxyClientDisableSTUN: {value: false},
  1014. InproxyClientDisablePortMapping: {value: false},
  1015. InproxyClientDisableInboundForMobileNetworks: {value: false},
  1016. InproxyClientDisableIPv6ICECandidates: {value: false},
  1017. InproxyProxyDiscoverNATTimeout: {value: 10 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1018. InproxyClientDiscoverNATTimeout: {value: 10 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1019. InproxyWebRTCAnswerTimeout: {value: 20 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1020. InproxyWebRTCAwaitPortMappingTimeout: {value: 2 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1021. InproxyProxyWebRTCAwaitReadyToProxyTimeout: {value: 30 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1022. InproxyClientWebRTCAwaitReadyToProxyTimeout: {value: 20 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1023. InproxyProxyDestinationDialTimeout: {value: 20 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1024. InproxyProxyRelayInactivityTimeout: {value: 5 * time.Minute, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1025. InproxyPsiphonAPIRequestTimeout: {value: 10 * time.Second, minimum: 1 * time.Second, flags: useNetworkLatencyMultiplier},
  1026. InproxyProxyTotalActivityNoticePeriod: {value: 5 * time.Minute, minimum: 1 * time.Second},
  1027. InproxyPersonalPairingConnectionWorkerPoolSize: {value: 2, minimum: 1},
  1028. InproxyClientDialRateLimitQuantity: {value: 2, minimum: 0},
  1029. InproxyClientDialRateLimitInterval: {value: 500 * time.Millisecond, minimum: time.Duration(0)},
  1030. InproxyClientNoMatchFailoverProbability: {value: 0.5, minimum: 0.0},
  1031. InproxyClientNoMatchFailoverPersonalProbability: {value: 1.0, minimum: 0.0},
  1032. InproxyFrontingProviderClientMaxRequestTimeouts: {value: KeyDurations{}},
  1033. InproxyFrontingProviderServerMaxRequestTimeouts: {value: KeyDurations{}, flags: serverSideOnly},
  1034. InproxyProxyOnBrokerClientFailedRetryPeriod: {value: 30 * time.Second, minimum: time.Duration(0)},
  1035. InproxyProxyIncompatibleNetworkTypes: {value: []string{}},
  1036. InproxyClientIncompatibleNetworkTypes: {value: []string{}},
  1037. InproxyReplayRetainFailedProbability: {value: 1.0, minimum: 0.0},
  1038. InproxyProxyDisableWaitToShareSession: {value: false},
  1039. InproxyClientDisableWaitToShareSession: {value: true},
  1040. InproxyTunnelProtocolPreferProbability: {value: 0.0, minimum: 0.0},
  1041. InproxyTunnelProtocolForceSelectionCount: {value: 0, minimum: 0},
  1042. InproxyEnableProxyQuality: {value: false, flags: serverSideOnly},
  1043. InproxyEnableProxyQualityClientRegions: {value: []string{}, flags: serverSideOnly},
  1044. InproxyProxyQualityTargetUpstreamBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  1045. InproxyProxyQualityTargetDownstreamBytes: {value: 0, minimum: 0, flags: serverSideOnly},
  1046. InproxyProxyQualityTargetDuration: {value: time.Duration(0), minimum: time.Duration(0), flags: serverSideOnly},
  1047. InproxyProxyQualityReporterMaxRequestEntries: {value: 1000, minimum: 1, flags: serverSideOnly},
  1048. InproxyProxyQualityReporterTrustedCACertificates: {value: "", flags: serverSideOnly},
  1049. InproxyProxyQualityReporterAdditionalHeaders: {value: http.Header{}, flags: serverSideOnly},
  1050. InproxyProxyQualityReporterRequestDelay: {value: 10 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  1051. InproxyProxyQualityReporterRequestTimeout: {value: 10 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  1052. InproxyProxyQualityReporterRequestRetries: {value: 2, minimum: 0, flags: serverSideOnly},
  1053. InproxyProxyQualityTTL: {value: 24 * time.Hour, minimum: time.Duration(0), flags: serverSideOnly},
  1054. InproxyProxyQualityPendingFailedMatchDeadline: {value: 5 * time.Minute, minimum: time.Duration(0), flags: serverSideOnly},
  1055. InproxyProxyQualityFailedMatchThreshold: {value: 10, minimum: 1, flags: serverSideOnly},
  1056. NetworkIDCacheTTL: {value: 500 * time.Millisecond, minimum: time.Duration(0)},
  1057. ServerDNSResolverCacheMaxSize: {value: 32, minimum: 0, flags: serverSideOnly},
  1058. ServerDNSResolverCacheTTL: {value: 10 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  1059. CheckServerEntryTagsEnabled: {value: true},
  1060. CheckServerEntryTagsPeriod: {value: 90 * 24 * time.Hour, minimum: time.Duration(0)},
  1061. CheckServerEntryTagsRepeatRatio: {value: 0.10, minimum: 0.0},
  1062. CheckServerEntryTagsRepeatMinimum: {value: 1, minimum: 0},
  1063. CheckServerEntryTagsMaxSendBytes: {value: 65536, minimum: 1},
  1064. CheckServerEntryTagsMaxWorkTime: {value: 60 * time.Second, minimum: time.Duration(0)},
  1065. ServerEntryPruneDialPortNumberZero: {value: true},
  1066. CompressTactics: {value: true},
  1067. DSLRelayServiceAddress: {value: "", flags: serverSideOnly},
  1068. DSLRelayMaxHttpConns: {value: 100, minimum: 1, flags: serverSideOnly},
  1069. DSLRelayMaxHttpIdleConns: {value: 10, minimum: 1, flags: serverSideOnly},
  1070. DSLRelayHttpIdleConnTimeout: {value: 120 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  1071. DSLRelayRequestTimeout: {value: 30 * time.Second, minimum: time.Duration(0), flags: serverSideOnly},
  1072. DSLRelayRetryCount: {value: 1, minimum: 0, flags: serverSideOnly},
  1073. DSLRelayCacheTTL: {value: 24 * time.Hour, minimum: time.Duration(0), flags: serverSideOnly},
  1074. DSLRelayCacheMaxSize: {value: 200000, minimum: 0, flags: serverSideOnly},
  1075. EnableDSLFetcher: {value: false},
  1076. DSLFetcherTunneledRequestTimeout: {value: 5 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1077. DSLFetcherTunneledRequestRetryCount: {value: 0, minimum: 0},
  1078. DSLFetcherTunneledRequestRetryDelay: {value: 5 * time.Second, minimum: time.Duration(0)},
  1079. DSLFetcherTunneledRequestRetryDelayJitter: {value: 0.3, minimum: 0.0},
  1080. DSLFetcherTunneledFetchTTL: {value: 1 * time.Hour, minimum: time.Duration(0)},
  1081. DSLFetcherTunneledDiscoverServerEntriesMinCount: {value: 1, minimum: 0},
  1082. DSLFetcherTunneledDiscoverServerEntriesMaxCount: {value: 2, minimum: 0},
  1083. DSLFetcherTunneledGetServerEntriesMinCount: {value: 30, minimum: 0},
  1084. DSLFetcherTunneledGetServerEntriesMaxCount: {value: 60, minimum: 0},
  1085. DSLFetcherUntunneledRequestTimeout: {value: 30 * time.Second, minimum: time.Duration(0), flags: useNetworkLatencyMultiplier},
  1086. DSLFetcherUntunneledRequestRetryCount: {value: 2, minimum: 0},
  1087. DSLFetcherUntunneledRequestRetryDelay: {value: 5 * time.Second, minimum: time.Duration(0)},
  1088. DSLFetcherUntunneledRequestRetryDelayJitter: {value: 0.3, minimum: 0.0},
  1089. DSLFetcherUntunneledFetchTTL: {value: 6 * time.Hour, minimum: time.Duration(0)},
  1090. DSLFetcherUntunneledDiscoverServerEntriesMinCount: {value: 200, minimum: 0},
  1091. DSLFetcherUntunneledDiscoverServerEntriesMaxCount: {value: 400, minimum: 0},
  1092. DSLFetcherUntunneledGetServerEntriesMinCount: {value: 30, minimum: 0},
  1093. DSLFetcherUntunneledGetServerEntriesMaxCount: {value: 60, minimum: 0},
  1094. DSLFetcherGetLastActiveOSLsTTL: {value: 24 * time.Hour, minimum: time.Duration(0)},
  1095. DSLFetcherGetOSLFileSpecsMinCount: {value: 1, minimum: 0},
  1096. DSLFetcherGetOSLFileSpecsMaxCount: {value: 1, minimum: 0},
  1097. }
  1098. // IsServerSideOnly indicates if the parameter specified by name is used
  1099. // server-side only.
  1100. func IsServerSideOnly(name string) bool {
  1101. defaultParameter, ok := defaultParameters[name]
  1102. return ok && (defaultParameter.flags&serverSideOnly) != 0
  1103. }
  1104. // Parameters is a set of parameters. To use the parameters, call Get. To
  1105. // apply new values to the parameters, call Set.
  1106. type Parameters struct {
  1107. getValueLogger func(error)
  1108. snapshot atomic.Value
  1109. }
  1110. // NewParameters initializes a new Parameters with the default parameter
  1111. // values.
  1112. //
  1113. // getValueLogger is optional, and is used to report runtime errors with
  1114. // getValue; see comment in getValue.
  1115. func NewParameters(
  1116. getValueLogger func(error)) (*Parameters, error) {
  1117. parameters := &Parameters{
  1118. getValueLogger: getValueLogger,
  1119. }
  1120. // Note: validationFlags excludes ValidationServerSide, so the
  1121. // Parameters.Set checkInproxyLists logic is not invoked; however, all
  1122. // the relevent lists currently default to empty values.
  1123. _, err := parameters.Set("", 0)
  1124. if err != nil {
  1125. return nil, errors.Trace(err)
  1126. }
  1127. return parameters, nil
  1128. }
  1129. func makeDefaultParameters() (map[string]interface{}, error) {
  1130. parameters := make(map[string]interface{})
  1131. for name, defaults := range defaultParameters {
  1132. if defaults.value == nil {
  1133. return nil, errors.Tracef("default parameter missing value: %s", name)
  1134. }
  1135. if defaults.minimum != nil &&
  1136. reflect.TypeOf(defaults.value) != reflect.TypeOf(defaults.minimum) {
  1137. return nil, errors.Tracef("default parameter value and minimum type mismatch: %s", name)
  1138. }
  1139. _, isDuration := defaults.value.(time.Duration)
  1140. if defaults.flags&useNetworkLatencyMultiplier != 0 && !isDuration {
  1141. return nil, errors.Tracef("default non-duration parameter uses multipler: %s", name)
  1142. }
  1143. parameters[name] = defaults.value
  1144. }
  1145. return parameters, nil
  1146. }
  1147. const (
  1148. // ValidationSkipOnError indicates whether invalid tactics are to be
  1149. // skipped/omitted, or if Set should fail on invalid tactics. In some
  1150. // cases, clients set ValidationSkipOnError as older client code may
  1151. // download newer tactics which do not validate; while servers perform
  1152. // strict validation.
  1153. ValidationSkipOnError = 1
  1154. // ValidationServerSide indicates whether the validation is server-side,
  1155. // in which case additonal checks referencing serverSideOnly parameters
  1156. // are performed.
  1157. ValidationServerSide = 2
  1158. )
  1159. // Set replaces the current parameters. First, a set of parameters are
  1160. // initialized using the default values. Then, each applyParameters is applied
  1161. // in turn, with the later instances having precedence.
  1162. //
  1163. // When skipOnError is true, unknown or invalid parameters in any
  1164. // applyParameters are skipped instead of aborting with an error.
  1165. //
  1166. // For protocol.TunnelProtocols and protocol.TLSProfiles type values, when
  1167. // skipOnError is true the values are filtered instead of validated, so
  1168. // only known tunnel protocols and TLS profiles are retained.
  1169. //
  1170. // When an error is returned, the previous parameters remain completely
  1171. // unmodified.
  1172. //
  1173. // For use in logging, Set returns a count of the number of parameters applied
  1174. // from each applyParameters.
  1175. func (p *Parameters) Set(
  1176. tag string,
  1177. validationFlags int,
  1178. applyParameters ...map[string]interface{}) ([]int, error) {
  1179. skipOnError := (validationFlags & ValidationSkipOnError) != 0
  1180. serverSide := (validationFlags & ValidationServerSide) != 0
  1181. makeTypedValue := func(templateValue, value interface{}) (interface{}, error) {
  1182. // Accept strings such as "1h" for duration parameters.
  1183. switch templateValue.(type) {
  1184. case time.Duration:
  1185. if s, ok := value.(string); ok {
  1186. if d, err := time.ParseDuration(s); err == nil {
  1187. value = d
  1188. }
  1189. }
  1190. }
  1191. // A JSON remarshal resolves cases where applyParameters is a
  1192. // result of unmarshal-into-interface, in which case non-scalar
  1193. // values will not have the expected types; see:
  1194. // https://golang.org/pkg/encoding/json/#Unmarshal. This remarshal
  1195. // also results in a deep copy.
  1196. marshaledValue, err := json.Marshal(value)
  1197. if err != nil {
  1198. return nil, errors.Trace(err)
  1199. }
  1200. newValuePtr := reflect.New(reflect.TypeOf(templateValue))
  1201. err = json.Unmarshal(marshaledValue, newValuePtr.Interface())
  1202. if err != nil {
  1203. return nil, errors.Trace(err)
  1204. }
  1205. return newValuePtr.Elem().Interface(), nil
  1206. }
  1207. getAppliedValue := func(
  1208. name string,
  1209. parameters map[string]interface{},
  1210. applyParameters []map[string]interface{}) (interface{}, error) {
  1211. templateValue := parameters[name]
  1212. if templateValue == nil {
  1213. return nil, errors.Tracef("unknown parameter: %s", name)
  1214. }
  1215. value := templateValue
  1216. for i := len(applyParameters) - 1; i >= 0; i-- {
  1217. if v := applyParameters[i][name]; v != nil {
  1218. value = v
  1219. break
  1220. }
  1221. }
  1222. return makeTypedValue(templateValue, value)
  1223. }
  1224. var counts []int
  1225. parameters, err := makeDefaultParameters()
  1226. if err != nil {
  1227. return nil, errors.Trace(err)
  1228. }
  1229. // Special case: TLSProfiles/LabeledTLSProfiles may reference
  1230. // CustomTLSProfiles names. Inspect the CustomTLSProfiles parameter and
  1231. // extract its names. Do not call Get().CustomTLSProfilesNames() as
  1232. // CustomTLSProfiles may not yet be validated.
  1233. customTLSProfilesValue, err := getAppliedValue(
  1234. CustomTLSProfiles, parameters, applyParameters)
  1235. if err != nil {
  1236. return nil, errors.Trace(err)
  1237. }
  1238. customTLSProfiles, _ := customTLSProfilesValue.(protocol.CustomTLSProfiles)
  1239. customTLSProfileNames := make([]string, len(customTLSProfiles))
  1240. for i, profile := range customTLSProfiles {
  1241. customTLSProfileNames[i] = profile.Name
  1242. }
  1243. // Special case: PacketManipulations will reference PacketManipulationSpecs.
  1244. serverPacketManipulationSpecsValue, err := getAppliedValue(
  1245. ServerPacketManipulationSpecs, parameters, applyParameters)
  1246. if err != nil {
  1247. return nil, errors.Trace(err)
  1248. }
  1249. serverPacketManipulationSpecs, _ :=
  1250. serverPacketManipulationSpecsValue.(PacketManipulationSpecs)
  1251. // Special case: ProtocolTransformScopedSpecNames will reference
  1252. // ProtocolTransformSpecs.
  1253. dnsResolverProtocolTransformSpecsValue, err := getAppliedValue(
  1254. DNSResolverProtocolTransformSpecs, parameters, applyParameters)
  1255. if err != nil {
  1256. return nil, errors.Trace(err)
  1257. }
  1258. dnsResolverProtocolTransformSpecs, _ :=
  1259. dnsResolverProtocolTransformSpecsValue.(transforms.Specs)
  1260. directHttpProtocolTransformSpecsValue, err := getAppliedValue(
  1261. DirectHTTPProtocolTransformSpecs, parameters, applyParameters)
  1262. if err != nil {
  1263. return nil, errors.Trace(err)
  1264. }
  1265. directHttpProtocolTransformSpecs, _ :=
  1266. directHttpProtocolTransformSpecsValue.(transforms.Specs)
  1267. frontedHttpProtocolTransformSpecsValue, err := getAppliedValue(
  1268. FrontedHTTPProtocolTransformSpecs, parameters, applyParameters)
  1269. if err != nil {
  1270. return nil, errors.Trace(err)
  1271. }
  1272. frontedHttpProtocolTransformSpecs, _ :=
  1273. frontedHttpProtocolTransformSpecsValue.(transforms.Specs)
  1274. osshObfuscatorSeedTransformSpecsValue, err := getAppliedValue(
  1275. OSSHObfuscatorSeedTransformSpecs, parameters, applyParameters)
  1276. if err != nil {
  1277. return nil, errors.Trace(err)
  1278. }
  1279. osshObfuscatorSeedTransformSpecs, _ :=
  1280. osshObfuscatorSeedTransformSpecsValue.(transforms.Specs)
  1281. obfuscatedQuicNonceTransformSpecsValue, err := getAppliedValue(
  1282. ObfuscatedQUICNonceTransformSpecs, parameters, applyParameters)
  1283. if err != nil {
  1284. return nil, errors.Trace(err)
  1285. }
  1286. obfuscatedQuicNonceTransformSpecs, _ :=
  1287. obfuscatedQuicNonceTransformSpecsValue.(transforms.Specs)
  1288. osshPrefixSpecsValue, err := getAppliedValue(
  1289. OSSHPrefixSpecs, parameters, applyParameters)
  1290. if err != nil {
  1291. return nil, errors.Trace(err)
  1292. }
  1293. osshPrefixSpecs, _ := osshPrefixSpecsValue.(transforms.Specs)
  1294. shadowsocksPrefixSpecsValue, err := getAppliedValue(
  1295. ShadowsocksPrefixSpecs, parameters, applyParameters)
  1296. if err != nil {
  1297. return nil, errors.Trace(err)
  1298. }
  1299. shadowsocksPrefixSpecs, _ := shadowsocksPrefixSpecsValue.(transforms.Specs)
  1300. // Special case: in-proxy broker specs in any InproxyBrokerSpecs must
  1301. // appear in InproxyAllBrokerSpecs; and in-proxy common compartment IDs
  1302. // must appear in InproxyAllCommonCompartmentIDs. This check is
  1303. // server-side only as the "All" parameters are serverSideOnly.
  1304. // Note that similar validation for InproxyAllBrokerPublicKeys has been
  1305. // retired, although InproxyAllBrokerPublicKeys is still present in
  1306. // defaultParameters for backwards compatibility during the transition to
  1307. // InproxyAllBrokerSpecs.
  1308. //
  1309. // TODO: fully retire InproxyAllBrokerPublicKeys.
  1310. checkInproxyLists := !skipOnError && serverSide
  1311. inproxyAllBrokerSpecsValue, err := getAppliedValue(
  1312. InproxyAllBrokerSpecs, parameters, applyParameters)
  1313. if err != nil {
  1314. return nil, errors.Trace(err)
  1315. }
  1316. inproxyAllBrokerSpecs, _ := inproxyAllBrokerSpecsValue.(InproxyBrokerSpecsValue)
  1317. // Fall back to InproxyBrokerSpecs if InproxyAllBrokerSpecs is not
  1318. // configured.
  1319. if len(inproxyAllBrokerSpecs) == 0 {
  1320. inproxyBrokerSpecsValue, err := getAppliedValue(
  1321. InproxyBrokerSpecs, parameters, applyParameters)
  1322. if err != nil {
  1323. return nil, errors.Trace(err)
  1324. }
  1325. inproxyAllBrokerSpecs, _ = inproxyBrokerSpecsValue.(InproxyBrokerSpecsValue)
  1326. }
  1327. inproxyAllCommonCompartmentIDsValue, err := getAppliedValue(
  1328. InproxyAllCommonCompartmentIDs, parameters, applyParameters)
  1329. if err != nil {
  1330. return nil, errors.Trace(err)
  1331. }
  1332. inproxyAllCommonCompartmentIDs, _ := inproxyAllCommonCompartmentIDsValue.([]string)
  1333. // Special case: skip validation of transforms.Specs on the client side,
  1334. // since the regen operations may be slow. transforms.Specs are still
  1335. // validated on the server side, before being sent to clients. If a
  1336. // client's transforms.Spec is somehow corrupted, the tunnel dial
  1337. // applying the transform will error out -- transforms.Specs.Validate
  1338. // simply invokes the same apply operations.
  1339. validateTransformSpecs := serverSide
  1340. for i := 0; i < len(applyParameters); i++ {
  1341. count := 0
  1342. for name, value := range applyParameters[i] {
  1343. templateValue, ok := parameters[name]
  1344. if !ok {
  1345. if skipOnError {
  1346. continue
  1347. }
  1348. return nil, errors.Tracef("unknown parameter: %s", name)
  1349. }
  1350. newValue, err := makeTypedValue(templateValue, value)
  1351. if err != nil {
  1352. if skipOnError {
  1353. continue
  1354. }
  1355. return nil, errors.Tracef(
  1356. "unmarshal parameter %s failed: %v", name, err)
  1357. }
  1358. // Perform type-specific validation for some cases.
  1359. // TODO: require RemoteServerListSignaturePublicKey when
  1360. // RemoteServerListURLs is set?
  1361. switch v := newValue.(type) {
  1362. case TransferURLs:
  1363. err := v.DecodeAndValidate()
  1364. if err != nil {
  1365. if skipOnError {
  1366. continue
  1367. }
  1368. return nil, errors.Trace(err)
  1369. }
  1370. case protocol.TunnelProtocols:
  1371. if skipOnError {
  1372. newValue = v.PruneInvalid()
  1373. } else {
  1374. err := v.Validate()
  1375. if err != nil {
  1376. return nil, errors.Trace(err)
  1377. }
  1378. }
  1379. case protocol.LabeledTunnelProtocols:
  1380. if skipOnError {
  1381. newValue = v.PruneInvalid()
  1382. } else {
  1383. err := v.Validate()
  1384. if err != nil {
  1385. return nil, errors.Trace(err)
  1386. }
  1387. }
  1388. case protocol.TLSProfiles:
  1389. if skipOnError {
  1390. newValue = v.PruneInvalid(customTLSProfileNames)
  1391. } else {
  1392. err := v.Validate(customTLSProfileNames)
  1393. if err != nil {
  1394. return nil, errors.Trace(err)
  1395. }
  1396. }
  1397. case protocol.LabeledTLSProfiles:
  1398. if skipOnError {
  1399. newValue = v.PruneInvalid(customTLSProfileNames)
  1400. } else {
  1401. err := v.Validate(customTLSProfileNames)
  1402. if err != nil {
  1403. return nil, errors.Trace(err)
  1404. }
  1405. }
  1406. case protocol.QUICVersions:
  1407. if skipOnError {
  1408. newValue = v.PruneInvalid()
  1409. } else {
  1410. err := v.Validate()
  1411. if err != nil {
  1412. return nil, errors.Trace(err)
  1413. }
  1414. }
  1415. case protocol.LabeledQUICVersions:
  1416. if skipOnError {
  1417. newValue = v.PruneInvalid()
  1418. } else {
  1419. err := v.Validate()
  1420. if err != nil {
  1421. return nil, errors.Trace(err)
  1422. }
  1423. }
  1424. case protocol.CustomTLSProfiles:
  1425. err := v.Validate()
  1426. if err != nil {
  1427. if skipOnError {
  1428. continue
  1429. }
  1430. return nil, errors.Trace(err)
  1431. }
  1432. case KeyValues:
  1433. err := v.Validate()
  1434. if err != nil {
  1435. if skipOnError {
  1436. continue
  1437. }
  1438. return nil, errors.Trace(err)
  1439. }
  1440. case KeyStrings:
  1441. err := v.Validate()
  1442. if err != nil {
  1443. if skipOnError {
  1444. continue
  1445. }
  1446. return nil, errors.Trace(err)
  1447. }
  1448. case KeyDurations:
  1449. err := v.Validate()
  1450. if err != nil {
  1451. if skipOnError {
  1452. continue
  1453. }
  1454. return nil, errors.Trace(err)
  1455. }
  1456. case *BPFProgramSpec:
  1457. if v != nil {
  1458. err := v.Validate()
  1459. if err != nil {
  1460. if skipOnError {
  1461. continue
  1462. }
  1463. return nil, errors.Trace(err)
  1464. }
  1465. }
  1466. case PacketManipulationSpecs:
  1467. err := v.Validate()
  1468. if err != nil {
  1469. if skipOnError {
  1470. continue
  1471. }
  1472. return nil, errors.Trace(err)
  1473. }
  1474. case ProtocolPacketManipulations:
  1475. var packetManipulationSpecs PacketManipulationSpecs
  1476. if name == ServerProtocolPacketManipulations {
  1477. packetManipulationSpecs = serverPacketManipulationSpecs
  1478. }
  1479. err := v.Validate(packetManipulationSpecs)
  1480. if err != nil {
  1481. if skipOnError {
  1482. continue
  1483. }
  1484. return nil, errors.Trace(err)
  1485. }
  1486. case RegexStrings:
  1487. err := v.Validate()
  1488. if err != nil {
  1489. if skipOnError {
  1490. continue
  1491. }
  1492. return nil, errors.Trace(err)
  1493. }
  1494. case FrontingSpecs:
  1495. // By default, FrontingSpecs are not permitted to specify
  1496. // SkipVerify. This includes the ConjureAPIRegistrarFrontingSpecs
  1497. // case which uses MeekModePlaintextRoundTrip.
  1498. allowSkipVerify := false
  1499. err := v.Validate(allowSkipVerify)
  1500. if err != nil {
  1501. if skipOnError {
  1502. continue
  1503. }
  1504. return nil, errors.Trace(err)
  1505. }
  1506. case TunnelProtocolPortLists:
  1507. err := v.Validate()
  1508. if err != nil {
  1509. if skipOnError {
  1510. continue
  1511. }
  1512. return nil, errors.Trace(err)
  1513. }
  1514. case LabeledCIDRs:
  1515. err := v.Validate()
  1516. if err != nil {
  1517. if skipOnError {
  1518. continue
  1519. }
  1520. return nil, errors.Trace(err)
  1521. }
  1522. case transforms.Specs:
  1523. if !validateTransformSpecs {
  1524. break
  1525. }
  1526. prefixMode := false
  1527. if name == OSSHPrefixSpecs || name == ServerOSSHPrefixSpecs || name == ShadowsocksPrefixSpecs {
  1528. prefixMode = true
  1529. }
  1530. err := v.Validate(prefixMode)
  1531. if err != nil {
  1532. if skipOnError {
  1533. continue
  1534. }
  1535. return nil, errors.Trace(err)
  1536. }
  1537. case transforms.ScopedSpecNames:
  1538. var specs transforms.Specs
  1539. if name == DNSResolverProtocolTransformScopedSpecNames {
  1540. specs = dnsResolverProtocolTransformSpecs
  1541. } else if name == DirectHTTPProtocolTransformScopedSpecNames {
  1542. specs = directHttpProtocolTransformSpecs
  1543. } else if name == FrontedHTTPProtocolTransformScopedSpecNames {
  1544. specs = frontedHttpProtocolTransformSpecs
  1545. } else if name == OSSHObfuscatorSeedTransformScopedSpecNames {
  1546. specs = osshObfuscatorSeedTransformSpecs
  1547. } else if name == ObfuscatedQUICNonceTransformScopedSpecNames {
  1548. specs = obfuscatedQuicNonceTransformSpecs
  1549. } else if name == OSSHPrefixScopedSpecNames {
  1550. specs = osshPrefixSpecs
  1551. } else if name == ShadowsocksPrefixScopedSpecNames {
  1552. specs = shadowsocksPrefixSpecs
  1553. }
  1554. err := v.Validate(specs)
  1555. if err != nil {
  1556. if skipOnError {
  1557. continue
  1558. }
  1559. return nil, errors.Trace(err)
  1560. }
  1561. case protocol.ConjureTransports:
  1562. if skipOnError {
  1563. newValue = v.PruneInvalid()
  1564. } else {
  1565. err := v.Validate()
  1566. if err != nil {
  1567. return nil, errors.Trace(err)
  1568. }
  1569. }
  1570. case InproxyBrokerSpecsValue:
  1571. var checkList *InproxyBrokerSpecsValue
  1572. if checkInproxyLists && name == InproxyBrokerSpecs {
  1573. checkList = &inproxyAllBrokerSpecs
  1574. }
  1575. err := v.Validate(checkList)
  1576. if err != nil {
  1577. if skipOnError {
  1578. continue
  1579. }
  1580. return nil, errors.Trace(err)
  1581. }
  1582. case InproxyCompartmentIDsValue:
  1583. var checkList *[]string
  1584. if checkInproxyLists && name == InproxyCommonCompartmentIDs {
  1585. checkList = &inproxyAllCommonCompartmentIDs
  1586. }
  1587. err := v.Validate(checkList)
  1588. if err != nil {
  1589. if skipOnError {
  1590. continue
  1591. }
  1592. return nil, errors.Trace(err)
  1593. }
  1594. case InproxyTrafficShapingParametersValue:
  1595. err := v.Validate()
  1596. if err != nil {
  1597. if skipOnError {
  1598. continue
  1599. }
  1600. return nil, errors.Trace(err)
  1601. }
  1602. case LivenessTestSpecs:
  1603. err := v.Validate()
  1604. if err != nil {
  1605. if skipOnError {
  1606. continue
  1607. }
  1608. return nil, errors.Trace(err)
  1609. }
  1610. }
  1611. // Enforce any minimums. Assumes defaultParameters[name]
  1612. // exists.
  1613. if defaultParameters[name].minimum != nil {
  1614. valid := true
  1615. switch v := newValue.(type) {
  1616. case int:
  1617. m, ok := defaultParameters[name].minimum.(int)
  1618. if !ok || v < m {
  1619. valid = false
  1620. }
  1621. case float64:
  1622. m, ok := defaultParameters[name].minimum.(float64)
  1623. if !ok || v < m {
  1624. valid = false
  1625. }
  1626. case time.Duration:
  1627. m, ok := defaultParameters[name].minimum.(time.Duration)
  1628. if !ok || v < m {
  1629. valid = false
  1630. }
  1631. default:
  1632. if skipOnError {
  1633. continue
  1634. }
  1635. return nil, errors.Tracef("unexpected parameter with minimum: %s", name)
  1636. }
  1637. if !valid {
  1638. if skipOnError {
  1639. continue
  1640. }
  1641. return nil, errors.Tracef("parameter below minimum: %s", name)
  1642. }
  1643. }
  1644. parameters[name] = newValue
  1645. count++
  1646. }
  1647. counts = append(counts, count)
  1648. }
  1649. snapshot := &parametersSnapshot{
  1650. getValueLogger: p.getValueLogger,
  1651. tag: tag,
  1652. parameters: parameters,
  1653. }
  1654. p.snapshot.Store(snapshot)
  1655. return counts, nil
  1656. }
  1657. // Get returns the current parameters.
  1658. //
  1659. // Values read from the current parameters are not deep copies and must be
  1660. // treated read-only.
  1661. //
  1662. // The returned ParametersAccessor may be used to read multiple related values
  1663. // atomically and consistently while the current set of values in Parameters
  1664. // may change concurrently.
  1665. //
  1666. // Get does not perform any heap allocations and is intended for repeated,
  1667. // direct, low-overhead invocations.
  1668. func (p *Parameters) Get() ParametersAccessor {
  1669. return ParametersAccessor{
  1670. snapshot: p.snapshot.Load().(*parametersSnapshot)}
  1671. }
  1672. // GetCustom returns the current parameters while also setting customizations
  1673. // for this instance.
  1674. //
  1675. // The properties of Get also apply to GetCustom: must be read-only; atomic
  1676. // and consisent view; no heap allocations.
  1677. //
  1678. // Customizations include:
  1679. //
  1680. // - customNetworkLatencyMultiplier, which overrides NetworkLatencyMultiplier
  1681. // for this instance only.
  1682. func (p *Parameters) GetCustom(
  1683. customNetworkLatencyMultiplier float64) ParametersAccessor {
  1684. return ParametersAccessor{
  1685. snapshot: p.snapshot.Load().(*parametersSnapshot),
  1686. customNetworkLatencyMultiplier: customNetworkLatencyMultiplier,
  1687. }
  1688. }
  1689. // parametersSnapshot is an atomic snapshot of the parameter values.
  1690. // Parameters.Get will return a snapshot which may be used to read multiple
  1691. // related values atomically and consistently while the current snapshot in
  1692. // Parameters may change concurrently.
  1693. type parametersSnapshot struct {
  1694. getValueLogger func(error)
  1695. tag string
  1696. parameters map[string]interface{}
  1697. }
  1698. // getValue sets target to the value of the named parameter.
  1699. //
  1700. // It is an error if the name is not found, target is not a pointer, or the
  1701. // type of target points to does not match the value.
  1702. //
  1703. // Any of these conditions would be a bug in the caller. getValue does not
  1704. // panic in these cases as clients are deployed as a library in various apps
  1705. // and the failure of Psiphon may not be a failure for the app process.
  1706. //
  1707. // Instead, errors are logged to the getValueLogger and getValue leaves the
  1708. // target unset, which will result in the caller getting and using a zero
  1709. // value of the requested type.
  1710. func (p *parametersSnapshot) getValue(name string, target interface{}) {
  1711. value, ok := p.parameters[name]
  1712. if !ok {
  1713. if p.getValueLogger != nil {
  1714. p.getValueLogger(errors.Tracef(
  1715. "value %s not found", name))
  1716. }
  1717. return
  1718. }
  1719. valueType := reflect.TypeOf(value)
  1720. if reflect.PtrTo(valueType) != reflect.TypeOf(target) {
  1721. if p.getValueLogger != nil {
  1722. p.getValueLogger(errors.Tracef(
  1723. "value %s has unexpected type %s", name, valueType.Name()))
  1724. }
  1725. return
  1726. }
  1727. // Note: there is no deep copy of parameter values; the returned value may
  1728. // share memory with the original and should not be modified.
  1729. targetValue := reflect.ValueOf(target)
  1730. if targetValue.Kind() != reflect.Ptr {
  1731. p.getValueLogger(errors.Tracef(
  1732. "target for value %s is not pointer", name))
  1733. return
  1734. }
  1735. targetValue.Elem().Set(reflect.ValueOf(value))
  1736. }
  1737. // ParametersAccessor provides consistent, atomic access to parameter values.
  1738. // Any customizations are applied transparently.
  1739. type ParametersAccessor struct {
  1740. snapshot *parametersSnapshot
  1741. customNetworkLatencyMultiplier float64
  1742. }
  1743. // MakeNilParametersAccessor produces a stub ParametersAccessor which returns
  1744. // true for IsNil. This may be used where a ParametersAccessor value is
  1745. // required, but Parameters.Get may not succeed. In contexts where
  1746. // MakeNilParametersAccessor may be used, calls to ParametersAccessor must
  1747. // first check IsNil before calling accessor functions.
  1748. func MakeNilParametersAccessor() ParametersAccessor {
  1749. return ParametersAccessor{}
  1750. }
  1751. // IsNil indicates that this ParametersAccessor is a stub and its accessor
  1752. // functions may not be called. A ParametersAccessor produced by
  1753. // Parameters.Get will never return true for IsNil and IsNil guards are not
  1754. // required for ParametersAccessors known to be produced by Parameters.Get.
  1755. func (p ParametersAccessor) IsNil() bool {
  1756. return p.snapshot == nil
  1757. }
  1758. // Close clears internal references to large memory objects, allowing them to
  1759. // be garbage collected. Call Close when done using a ParametersAccessor,
  1760. // where memory footprint is a concern, and where the ParametersAccessor is
  1761. // not immediately going out of scope. After Close is called, all other
  1762. // ParametersAccessor functions will panic if called.
  1763. //
  1764. // Limitation: since ParametersAccessor is typically passed by value, this
  1765. // Close call only impacts the immediate copy.
  1766. func (p *ParametersAccessor) Close() {
  1767. p.snapshot = nil
  1768. }
  1769. // Tag returns the tag associated with these parameters.
  1770. func (p ParametersAccessor) Tag() string {
  1771. return p.snapshot.tag
  1772. }
  1773. // String returns a string parameter value.
  1774. func (p ParametersAccessor) String(name string) string {
  1775. value := ""
  1776. p.snapshot.getValue(name, &value)
  1777. return value
  1778. }
  1779. // Strings returns a []string parameter value. If multiple parameter names are
  1780. // specified, the first name with a non-empty value is used.
  1781. func (p ParametersAccessor) Strings(names ...string) []string {
  1782. for _, name := range names {
  1783. value := []string{}
  1784. p.snapshot.getValue(name, &value)
  1785. if len(value) > 0 {
  1786. return value
  1787. }
  1788. }
  1789. return []string{}
  1790. }
  1791. // Int returns an int parameter value.
  1792. func (p ParametersAccessor) Int(name string) int {
  1793. value := int(0)
  1794. p.snapshot.getValue(name, &value)
  1795. return value
  1796. }
  1797. // Bool returns a bool parameter value.
  1798. func (p ParametersAccessor) Bool(name string) bool {
  1799. value := false
  1800. p.snapshot.getValue(name, &value)
  1801. return value
  1802. }
  1803. // Float returns a float64 parameter value.
  1804. func (p ParametersAccessor) Float(name string) float64 {
  1805. value := float64(0.0)
  1806. p.snapshot.getValue(name, &value)
  1807. return value
  1808. }
  1809. // WeightedCoinFlip returns the result of prng.FlipWeightedCoin using the
  1810. // specified float parameter as the probability input.
  1811. func (p ParametersAccessor) WeightedCoinFlip(name string) bool {
  1812. var value float64
  1813. p.snapshot.getValue(name, &value)
  1814. return prng.FlipWeightedCoin(value)
  1815. }
  1816. // Duration returns a time.Duration parameter value. When the duration
  1817. // parameter has the useNetworkLatencyMultiplier flag, the
  1818. // NetworkLatencyMultiplier is applied to the returned value.
  1819. func (p ParametersAccessor) Duration(name string) time.Duration {
  1820. value := time.Duration(0)
  1821. p.snapshot.getValue(name, &value)
  1822. defaultParameter, ok := defaultParameters[name]
  1823. if value > 0 && ok && defaultParameter.flags&useNetworkLatencyMultiplier != 0 {
  1824. multiplier := float64(0.0)
  1825. if p.customNetworkLatencyMultiplier != 0.0 {
  1826. multiplier = p.customNetworkLatencyMultiplier
  1827. } else {
  1828. p.snapshot.getValue(NetworkLatencyMultiplier, &multiplier)
  1829. }
  1830. if multiplier > 0.0 {
  1831. value = time.Duration(float64(value) * multiplier)
  1832. }
  1833. }
  1834. return value
  1835. }
  1836. // TunnelProtocols returns a protocol.TunnelProtocols parameter value.
  1837. // If there is a corresponding Probability value, a weighted coin flip
  1838. // will be performed and, depending on the result, the value or the
  1839. // parameter default will be returned.
  1840. func (p ParametersAccessor) TunnelProtocols(name string) protocol.TunnelProtocols {
  1841. probabilityName := name + "Probability"
  1842. _, ok := p.snapshot.parameters[probabilityName]
  1843. if ok {
  1844. probabilityValue := float64(1.0)
  1845. p.snapshot.getValue(probabilityName, &probabilityValue)
  1846. if !prng.FlipWeightedCoin(probabilityValue) {
  1847. defaultParameter, ok := defaultParameters[name]
  1848. if ok {
  1849. defaultValue, ok := defaultParameter.value.(protocol.TunnelProtocols)
  1850. if ok {
  1851. value := make(protocol.TunnelProtocols, len(defaultValue))
  1852. copy(value, defaultValue)
  1853. return value
  1854. }
  1855. }
  1856. }
  1857. }
  1858. value := protocol.TunnelProtocols{}
  1859. p.snapshot.getValue(name, &value)
  1860. return value
  1861. }
  1862. // LabeledTunnelProtocols returns a protocol.TunnelProtocols parameter value
  1863. // corresponding to the specified labeled set and label value. The return
  1864. // value is nil when no set is found.
  1865. func (p ParametersAccessor) LabeledTunnelProtocols(name, label string) protocol.TunnelProtocols {
  1866. var value protocol.LabeledTunnelProtocols
  1867. p.snapshot.getValue(name, &value)
  1868. return value[label]
  1869. }
  1870. // TLSProfiles returns a protocol.TLSProfiles parameter value.
  1871. // If there is a corresponding Probability value, a weighted coin flip
  1872. // will be performed and, depending on the result, the value or the
  1873. // parameter default will be returned.
  1874. func (p ParametersAccessor) TLSProfiles(name string) protocol.TLSProfiles {
  1875. probabilityName := name + "Probability"
  1876. _, ok := p.snapshot.parameters[probabilityName]
  1877. if ok {
  1878. probabilityValue := float64(1.0)
  1879. p.snapshot.getValue(probabilityName, &probabilityValue)
  1880. if !prng.FlipWeightedCoin(probabilityValue) {
  1881. defaultParameter, ok := defaultParameters[name]
  1882. if ok {
  1883. defaultValue, ok := defaultParameter.value.(protocol.TLSProfiles)
  1884. if ok {
  1885. value := make(protocol.TLSProfiles, len(defaultValue))
  1886. copy(value, defaultValue)
  1887. return value
  1888. }
  1889. }
  1890. }
  1891. }
  1892. value := protocol.TLSProfiles{}
  1893. p.snapshot.getValue(name, &value)
  1894. return value
  1895. }
  1896. // LabeledTLSProfiles returns a protocol.TLSProfiles parameter value
  1897. // corresponding to the specified labeled set and label value. The return
  1898. // value is nil when no set is found.
  1899. func (p ParametersAccessor) LabeledTLSProfiles(name, label string) protocol.TLSProfiles {
  1900. var value protocol.LabeledTLSProfiles
  1901. p.snapshot.getValue(name, &value)
  1902. return value[label]
  1903. }
  1904. // QUICVersions returns a protocol.QUICVersions parameter value.
  1905. // If there is a corresponding Probability value, a weighted coin flip
  1906. // will be performed and, depending on the result, the value or the
  1907. // parameter default will be returned.
  1908. func (p ParametersAccessor) QUICVersions(name string) protocol.QUICVersions {
  1909. probabilityName := name + "Probability"
  1910. _, ok := p.snapshot.parameters[probabilityName]
  1911. if ok {
  1912. probabilityValue := float64(1.0)
  1913. p.snapshot.getValue(probabilityName, &probabilityValue)
  1914. if !prng.FlipWeightedCoin(probabilityValue) {
  1915. defaultParameter, ok := defaultParameters[name]
  1916. if ok {
  1917. defaultValue, ok := defaultParameter.value.(protocol.QUICVersions)
  1918. if ok {
  1919. value := make(protocol.QUICVersions, len(defaultValue))
  1920. copy(value, defaultValue)
  1921. return value
  1922. }
  1923. }
  1924. }
  1925. }
  1926. value := protocol.QUICVersions{}
  1927. p.snapshot.getValue(name, &value)
  1928. return value
  1929. }
  1930. // LabeledQUICVersions returns a protocol.QUICVersions parameter value
  1931. // corresponding to the specified labeled set and label value. The return
  1932. // value is nil when no set is found.
  1933. func (p ParametersAccessor) LabeledQUICVersions(name, label string) protocol.QUICVersions {
  1934. value := protocol.LabeledQUICVersions{}
  1935. p.snapshot.getValue(name, &value)
  1936. return value[label]
  1937. }
  1938. // TransferURLs returns a TransferURLs parameter value.
  1939. func (p ParametersAccessor) TransferURLs(name string) TransferURLs {
  1940. value := TransferURLs{}
  1941. p.snapshot.getValue(name, &value)
  1942. return value
  1943. }
  1944. // RateLimits returns a common.RateLimits parameter value.
  1945. func (p ParametersAccessor) RateLimits(name string) common.RateLimits {
  1946. value := common.RateLimits{}
  1947. p.snapshot.getValue(name, &value)
  1948. return value
  1949. }
  1950. // HTTPHeaders returns an http.Header parameter value.
  1951. func (p ParametersAccessor) HTTPHeaders(name string) http.Header {
  1952. value := make(http.Header)
  1953. p.snapshot.getValue(name, &value)
  1954. return value
  1955. }
  1956. // CustomTLSProfileNames returns the CustomTLSProfile.Name fields for
  1957. // each profile in the CustomTLSProfiles parameter value.
  1958. func (p ParametersAccessor) CustomTLSProfileNames() []string {
  1959. value := protocol.CustomTLSProfiles{}
  1960. p.snapshot.getValue(CustomTLSProfiles, &value)
  1961. names := make([]string, len(value))
  1962. for i := 0; i < len(value); i++ {
  1963. names[i] = value[i].Name
  1964. }
  1965. return names
  1966. }
  1967. // CustomTLSProfile returns the CustomTLSProfile fields with the specified
  1968. // Name field if it exists in the CustomTLSProfiles parameter value.
  1969. // Returns nil if not found.
  1970. func (p ParametersAccessor) CustomTLSProfile(name string) *protocol.CustomTLSProfile {
  1971. value := protocol.CustomTLSProfiles{}
  1972. p.snapshot.getValue(CustomTLSProfiles, &value)
  1973. // Note: linear lookup -- assumes a short list
  1974. for i := 0; i < len(value); i++ {
  1975. if value[i].Name == name {
  1976. return value[i]
  1977. }
  1978. }
  1979. return nil
  1980. }
  1981. // KeyValues returns a KeyValues parameter value.
  1982. func (p ParametersAccessor) KeyValues(name string) KeyValues {
  1983. value := KeyValues{}
  1984. p.snapshot.getValue(name, &value)
  1985. return value
  1986. }
  1987. // KeyStrings returns a KeyStrings parameter value.
  1988. func (p ParametersAccessor) KeyStrings(name, key string) []string {
  1989. value := KeyStrings{}
  1990. p.snapshot.getValue(name, &value)
  1991. return value[key]
  1992. }
  1993. // KeyStringsValue returns a complete KeyStrings parameter value.
  1994. func (p ParametersAccessor) KeyStringsValue(name string) KeyStrings {
  1995. value := KeyStrings{}
  1996. p.snapshot.getValue(name, &value)
  1997. return value
  1998. }
  1999. // KeyDurations returns a KeyDurations parameter value, with string durations
  2000. // converted to time.Duration.
  2001. func (p ParametersAccessor) KeyDurations(name string) map[string]time.Duration {
  2002. value := KeyDurations{}
  2003. p.snapshot.getValue(name, &value)
  2004. durations := make(map[string]time.Duration)
  2005. for key, duration := range value {
  2006. d, err := time.ParseDuration(duration)
  2007. if err != nil {
  2008. // Skip invalid duration. Not expected with validation.
  2009. continue
  2010. }
  2011. durations[key] = d
  2012. }
  2013. return durations
  2014. }
  2015. // BPFProgram returns an assembled BPF program corresponding to a
  2016. // BPFProgramSpec parameter value. Returns nil in the case of any empty
  2017. // program.
  2018. func (p ParametersAccessor) BPFProgram(name string) (bool, string, []bpf.RawInstruction) {
  2019. var value *BPFProgramSpec
  2020. p.snapshot.getValue(name, &value)
  2021. if value == nil {
  2022. return false, "", nil
  2023. }
  2024. // Validation checks that Assemble is successful.
  2025. rawInstructions, _ := value.Assemble()
  2026. return true, value.Name, rawInstructions
  2027. }
  2028. // PacketManipulationSpecs returns a PacketManipulationSpecs parameter value.
  2029. func (p ParametersAccessor) PacketManipulationSpecs(name string) PacketManipulationSpecs {
  2030. value := PacketManipulationSpecs{}
  2031. p.snapshot.getValue(name, &value)
  2032. return value
  2033. }
  2034. // ProtocolPacketManipulations returns a ProtocolPacketManipulations parameter value.
  2035. func (p ParametersAccessor) ProtocolPacketManipulations(name string) ProtocolPacketManipulations {
  2036. value := make(ProtocolPacketManipulations)
  2037. p.snapshot.getValue(name, &value)
  2038. return value
  2039. }
  2040. // RegexStrings returns a RegexStrings parameter value.
  2041. func (p ParametersAccessor) RegexStrings(name string) RegexStrings {
  2042. value := RegexStrings{}
  2043. p.snapshot.getValue(name, &value)
  2044. return value
  2045. }
  2046. // FrontingSpecs returns a FrontingSpecs parameter value.
  2047. func (p ParametersAccessor) FrontingSpecs(name string) FrontingSpecs {
  2048. value := FrontingSpecs{}
  2049. p.snapshot.getValue(name, &value)
  2050. return value
  2051. }
  2052. // TunnelProtocolPortLists returns a TunnelProtocolPortLists parameter value.
  2053. func (p ParametersAccessor) TunnelProtocolPortLists(name string) TunnelProtocolPortLists {
  2054. probabilityName := name + "Probability"
  2055. _, ok := p.snapshot.parameters[probabilityName]
  2056. if ok {
  2057. probabilityValue := float64(1.0)
  2058. p.snapshot.getValue(probabilityName, &probabilityValue)
  2059. if !prng.FlipWeightedCoin(probabilityValue) {
  2060. defaultParameter, ok := defaultParameters[name]
  2061. if ok {
  2062. defaultValue, ok := defaultParameter.value.(TunnelProtocolPortLists)
  2063. if ok {
  2064. value := make(TunnelProtocolPortLists)
  2065. for tunnelProtocol, portLists := range defaultValue {
  2066. value[tunnelProtocol] = portLists
  2067. }
  2068. return value
  2069. }
  2070. }
  2071. }
  2072. }
  2073. value := make(TunnelProtocolPortLists)
  2074. p.snapshot.getValue(name, &value)
  2075. return value
  2076. }
  2077. // LabeledCIDRs returns a CIDR string list parameter value corresponding to
  2078. // the specified labeled set and label value. The return value is nil when no
  2079. // set is found.
  2080. func (p ParametersAccessor) LabeledCIDRs(name, label string) []string {
  2081. value := LabeledCIDRs{}
  2082. p.snapshot.getValue(name, &value)
  2083. return value[label]
  2084. }
  2085. // ProtocolTransformSpecs returns a transforms.Specs parameter value.
  2086. func (p ParametersAccessor) ProtocolTransformSpecs(name string) transforms.Specs {
  2087. value := transforms.Specs{}
  2088. p.snapshot.getValue(name, &value)
  2089. return value
  2090. }
  2091. // ProtocolTransformScopedSpecNames returns a transforms.ScopedSpecNames
  2092. // parameter value.
  2093. func (p ParametersAccessor) ProtocolTransformScopedSpecNames(name string) transforms.ScopedSpecNames {
  2094. value := transforms.ScopedSpecNames{}
  2095. p.snapshot.getValue(name, &value)
  2096. return value
  2097. }
  2098. // ConjureTransports returns a protocol.ConjureTransports parameter value. If
  2099. // there is a corresponding Probability value, a weighted coin flip will be
  2100. // performed and, depending on the result, the value or the parameter default
  2101. // will be returned.
  2102. func (p ParametersAccessor) ConjureTransports(name string) protocol.ConjureTransports {
  2103. probabilityName := name + "Probability"
  2104. _, ok := p.snapshot.parameters[probabilityName]
  2105. if ok {
  2106. probabilityValue := float64(1.0)
  2107. p.snapshot.getValue(probabilityName, &probabilityValue)
  2108. if !prng.FlipWeightedCoin(probabilityValue) {
  2109. defaultParameter, ok := defaultParameters[name]
  2110. if ok {
  2111. defaultValue, ok := defaultParameter.value.(protocol.ConjureTransports)
  2112. if ok {
  2113. value := make(protocol.ConjureTransports, len(defaultValue))
  2114. copy(value, defaultValue)
  2115. return value
  2116. }
  2117. }
  2118. }
  2119. }
  2120. value := protocol.ConjureTransports{}
  2121. p.snapshot.getValue(name, &value)
  2122. return value
  2123. }
  2124. // InproxyBrokerSpecs returns a InproxyBrokerSpecs parameter value. If
  2125. // multiple parameter names are specified, the first name with a non-empty
  2126. // value is used.
  2127. func (p ParametersAccessor) InproxyBrokerSpecs(names ...string) InproxyBrokerSpecsValue {
  2128. for _, name := range names {
  2129. value := InproxyBrokerSpecsValue{}
  2130. p.snapshot.getValue(name, &value)
  2131. if len(value) > 0 {
  2132. return value
  2133. }
  2134. }
  2135. return InproxyBrokerSpecsValue{}
  2136. }
  2137. // InproxyBrokerSpecs returns a InproxyBrokerSpecs parameter value.
  2138. func (p ParametersAccessor) InproxyCompartmentIDs(name string) InproxyCompartmentIDsValue {
  2139. value := InproxyCompartmentIDsValue{}
  2140. p.snapshot.getValue(name, &value)
  2141. return value
  2142. }
  2143. // InproxyTrafficShapingParameters returns a InproxyTrafficShapingParameters
  2144. // parameter value.
  2145. func (p ParametersAccessor) InproxyTrafficShapingParameters(
  2146. name string) InproxyTrafficShapingParametersValue {
  2147. value := InproxyTrafficShapingParametersValue{}
  2148. p.snapshot.getValue(name, &value)
  2149. return value
  2150. }
  2151. func (p ParametersAccessor) LivenessTest(name string) LivenessTestSpecs {
  2152. value := make(LivenessTestSpecs)
  2153. p.snapshot.getValue(name, &value)
  2154. return value
  2155. }