parameters.go 125 KB

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