parameters.go 99 KB

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