Managed Profile
Surge can automatically update a profile from a URL. A managed profile starts with:
#!MANAGED-CONFIG http://test.com/surge.conf interval=60 strict=true
The profile can only be updated while the main Surge app is running.
Ensure the new remote profile also includes the #!MANAGED-CONFIG line. Without it, the profile reverts to a standard profile.
Parameters
interval: Optional, in seconds, default: 86400
Set the update interval for the profile. This is the shortest time before an update may be triggered; Surge does not necessarily update immediately after the interval passes.
strict: Optional, Boolean, default: false
If strict is true, Surge requires a successful update after the interval arrives. Otherwise, if the update fails, the user may continue using the outdated profile.
Note: Even when
strictis true, the user can still start Surge from a widget or the VPN switch in Settings.
REQUIREMENT Statement
The !REQUIREMENT statement can be used at the beginning or end of a profile line to limit the line's effect to specific environments.
#!REQUIREMENT CORE_VERSION>=22 Group = smart, policyA, policyB
or
Group = url, policyA, policyB //!REQUIREMENT CORE_VERSION<22
Variables that can be used for conditions include CORE_VERSION, SYSTEM, SYSTEM_VERSION, DEVICE_MODEL, and LANGUAGE.
Available operators are =, ==, >=, =>, <=, =<, >, <, !, <>, AND, &&, OR, ||, NOT, !, BEGINSWITH, CONTAINS, ENDSWITH, LIKE, and MATCHES.
A typical example of a variable value:
CORE_VERSION: 22
SYSTEM: iOS
SYSTEM_VERSION: System Version 17.4.1 (Build 21E236)
DEVICE_MODEL: iPhone16,1
LANGUAGE: en-US
Core Version
When Surge releases features with new profile syntax, the corresponding Core Version increases. This version can be used to determine whether a feature is available.
- 22: Surge Mac 5.7.0, Surge iOS 5.11.0, Smart Group
- 20: Surge Mac 5.6.0, Surge iOS 5.10.0, Body Rewrite, Inline Map Local
Strings in expressions should be wrapped in '. When an expression contains spaces, wrap the whole expression in ".
#!REQUIREMENT "CORE_VERSION>=22 AND SYSTEM=='iOS'" Group = smart, policyA, policyB
Expressions are lost when modifying a profile in the UI, so this feature is mainly used for managed and enterprise profiles.
Versions earlier than Surge iOS 5.11.0 and Mac 5.7.0 do not support this expression, so both beginning-of-line and end-of-line notations are available for compatibility. For example, if you want to use Smart Group for clients that support it, you can write:
#!REQUIREMENT CORE_VERSION>=22 Group = smart, policyA, policyB
Group = url-test, policyA, policyB //!REQUIREMENT CORE_VERSION<22
In older versions, the first line is treated as a comment and has no effect. The end-of-line requirement on the second line is also treated as a normal comment, so only the second line takes effect.
FORBIDDEN-AUTO-UPGRADE Statement
Starting with Surge iOS 5.11.0 and Mac 5.7.0, Surge can automatically optimize profiles during upgrades so managed profiles can use newer features when possible.
If you do not want the profile to apply certain automatic optimizations, use the FORBIDDEN-AUTO-UPGRADE expression.
Example:
#!FORBIDDEN-AUTO-UPGRADE smart-group
Currently available optimization keywords include
smart-group: automatically upgradesurl-test/load-balancegroups tosmartgroups.