@@ -93,6 +93,7 @@ - (void) writeDefaultSettings {
9393 @" selectedServerIndex" : [NSNumber numberWithInteger: 0 ],
9494 @" localPort" : [NSNumber numberWithInteger: 1081 ],
9595 @" udpSupport" : [NSNumber numberWithBool: NO ],
96+ @" shareOverLan" : [NSNumber numberWithBool: NO ],
9697 @" dns" : @" localhost" ,
9798 @" useTLS" : [NSNumber numberWithBool: NO ],
9899 @" tlsSettings" : @{
@@ -254,6 +255,7 @@ - (NSDictionary*)readDefaultsAsDictionary {
254255 NSNumber *dMode = nilCoalescing ([defaults objectForKey: @" proxyMode" ], @0 ); // use v2ray rules as defualt mode
255256 NSNumber * dLocalPort = nilCoalescing ([defaults objectForKey: @" localPort" ], @1081 );// use 1081 as default local port
256257 NSNumber * dUdpSupport = nilCoalescing ([defaults objectForKey: @" udpSupport" ], [NSNumber numberWithBool: NO ]);// do not support udp as default
258+ NSNumber * dShareOverLan = nilCoalescing ([defaults objectForKey: @" shareOverLan" ], [NSNumber numberWithBool: NO ]); // do not share over lan as default
257259 NSString *dDnsString = nilCoalescing ([defaults objectForKey: @" dns" ], @" " );
258260 NSMutableArray *dProfilesInPlist = [defaults objectForKey: @" profiles" ];
259261 NSMutableArray *dProfiles = [[NSMutableArray alloc ] init ];
@@ -285,6 +287,7 @@ - (NSDictionary*)readDefaultsAsDictionary {
285287 @" proxyMode" : dMode,
286288 @" localPort" : dLocalPort,
287289 @" udpSupport" : dUdpSupport,
290+ @" shareOverLan" : dShareOverLan,
288291 @" profiles" : dProfiles,
289292 @" selectedServerIndex" : dServerIndex,
290293 @" dns" :dDnsString};
@@ -301,7 +304,7 @@ -(void)unloadV2ray {
301304-(BOOL )loadV2ray {
302305 NSString *configPath = [NSString stringWithFormat: @" %@ /Library/Application Support/V2RayX/config.json" ,NSHomeDirectory ()];
303306 printf (" proxy mode is %ld \n " , (long )proxyMode);
304- NSDictionary *configDic = [[profiles objectAtIndex: selectedServerIndex] v2rayConfigWithLocalPort: localPort udpSupport: udpSupport v2rayRules : proxyMode == 0 ];
307+ NSDictionary *configDic = [[profiles objectAtIndex: selectedServerIndex] v2rayConfigWithRules : proxyMode == 0 ];
305308 NSData * v2rayJSONconfig = [NSJSONSerialization dataWithJSONObject: configDic options: NSJSONWritingPrettyPrinted error: nil ];
306309 [v2rayJSONconfig writeToFile: configPath atomically: NO ];
307310 [self generateLaunchdPlist: plistPath];
0 commit comments