@@ -11,7 +11,7 @@ namespace Shadowsocks.Model
11
11
public class Configuration
12
12
{
13
13
[ JsonIgnore ]
14
- private static Logger logger = LogManager . GetCurrentClassLogger ( ) ;
14
+ private static readonly Logger logger = LogManager . GetCurrentClassLogger ( ) ;
15
15
16
16
public string version ;
17
17
@@ -24,16 +24,10 @@ public class Configuration
24
24
public bool enabled ;
25
25
public bool shareOverLan ;
26
26
public bool isDefault ;
27
- // hidden
28
- public bool isIPv6Enabled = false ;
29
27
public int localPort ;
30
28
public bool portableMode = true ;
31
29
public bool showPluginOutput ;
32
30
public string pacUrl ;
33
- // geosite config is hidden
34
- public string geositeUrl ;
35
- public string geositeGroup = "geolocation-!cn" ;
36
- public bool geositeBlacklistMode = true ;
37
31
38
32
public bool useOnlinePac ;
39
33
public bool secureLocalPac = true ;
@@ -42,8 +36,13 @@ public class Configuration
42
36
public bool checkPreRelease ;
43
37
public bool isVerboseLogging ;
44
38
45
- // hidden config
46
- public bool generateLegacyUrl = false ;
39
+ // hidden options
40
+ public bool isIPv6Enabled = false ; // for experimental ipv6 support
41
+ public bool generateLegacyUrl = false ; // for pre-sip002 url compatibility
42
+ public string geositeUrl ; // for custom geosite source (and rule group)
43
+ public string geositeGroup = "geolocation-!cn" ;
44
+ public bool geositeBlacklistMode = true ;
45
+
47
46
48
47
//public NLogConfig.LogLevel logLevel;
49
48
public LogViewerConfig logViewer ;
@@ -54,11 +53,10 @@ public class Configuration
54
53
NLogConfig nLogConfig ;
55
54
56
55
private static readonly string CONFIG_FILE = "gui-config.json" ;
57
- private static readonly NLogConfig . LogLevel verboseLogLevel =
58
56
#if DEBUG
59
- NLogConfig . LogLevel . Trace ;
57
+ private static readonly NLogConfig . LogLevel verboseLogLevel = NLogConfig . LogLevel . Trace ;
60
58
#else
61
- NLogConfig . LogLevel . Debug ;
59
+ private static readonly NLogConfig . LogLevel verboseLogLevel = NLogConfig . LogLevel . Debug ;
62
60
#endif
63
61
64
62
@@ -200,9 +198,9 @@ public static void Save(Configuration config)
200
198
sw . Flush ( ) ;
201
199
}
202
200
try
203
- {
204
- // apply changs to NLog.config
205
- config . nLogConfig . SetLogLevel ( config . isVerboseLogging ? verboseLogLevel : NLogConfig . LogLevel . Info ) ;
201
+ {
202
+ // apply changes to NLog.config
203
+ config . nLogConfig . SetLogLevel ( config . isVerboseLogging ? verboseLogLevel : NLogConfig . LogLevel . Info ) ;
206
204
NLogConfig . SaveXML ( config . nLogConfig ) ;
207
205
}
208
206
catch ( Exception e )
@@ -218,7 +216,7 @@ public static void Save(Configuration config)
218
216
219
217
public static Server AddDefaultServerOrServer ( Configuration config , Server server = null , int ? index = null )
220
218
{
221
- if ( config != null && config . configs != null )
219
+ if ( config ? . configs != null )
222
220
{
223
221
server = ( server ?? GetDefaultServer ( ) ) ;
224
222
@@ -237,12 +235,6 @@ public static Server GetDefaultServer()
237
235
return new Server ( ) ;
238
236
}
239
237
240
- private static void Assert ( bool condition )
241
- {
242
- if ( ! condition )
243
- throw new Exception ( I18N . GetString ( "assertion failure" ) ) ;
244
- }
245
-
246
238
public static void CheckPort ( int port )
247
239
{
248
240
if ( port <= 0 || port > 65535 )
0 commit comments