parameters.go 122 KB

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