@@ -12,14 +12,15 @@ @implementation ServerProfile
12
12
- (ServerProfile*)init {
13
13
self = [super init ];
14
14
if (self) {
15
- [self setProtocol: @" vmess" ];
15
+ [self setProtocol: vmess];
16
16
[self setAddress: @" server.cc" ];
17
17
[self setPort: 10086 ];
18
18
[self setUserId: @" 00000000-0000-0000-0000-000000000000" ];
19
19
[self setAlterId: 64 ];
20
20
[self setLevel: 0 ];
21
21
[self setOutboundTag: @" test server" ];
22
- [self setSecurity: auto_];
22
+ [self setFlow: none_flow];
23
+ [self setSecurity: none_security];
23
24
[self setNetwork: tcp];
24
25
[self setSendThrough: @" 0.0.0.0" ];
25
26
[self setStreamSettings: @{
@@ -30,6 +31,9 @@ - (ServerProfile*)init {
30
31
@" allowInsecure" : [NSNumber numberWithBool: NO ],
31
32
@" allowInsecureCiphers" : [NSNumber numberWithBool: NO ]
32
33
},
34
+ @" xtlsSettings" : @{
35
+ @" allowInsecure" : [NSNumber numberWithBool: NO ]
36
+ },
33
37
@" tcpSettings" : @{
34
38
@" header" : @{
35
39
@" type" : @" none"
@@ -87,7 +91,7 @@ + (NSArray*)profilesFromJson:(NSDictionary*)outboundJson {
87
91
}
88
92
for (NSDictionary * vnext in [outboundJson valueForKeyPath: @" settings.vnext" ]) {
89
93
ServerProfile* profile = [[ServerProfile alloc ] init ];
90
- profile.protocol = nilCoalescing (outboundJson[@" protocol" ], @" vmess " );
94
+ profile.protocol = searchInArray (outboundJson[@" protocol" ], PROTOCOL_LIST );
91
95
profile.address = nilCoalescing (vnext[@" address" ], @" 127.0.0.1" );
92
96
profile.outboundTag = nilCoalescing (outboundJson[@" tag" ], @" " );
93
97
profile.port = [vnext[@" port" ] unsignedIntegerValue ];
@@ -97,6 +101,7 @@ + (NSArray*)profilesFromJson:(NSDictionary*)outboundJson {
97
101
profile.userId = nilCoalescing (vnext[@" users" ][0 ][@" id" ], @" 23ad6b10-8d1a-40f7-8ad0-e3e35cd38287" );
98
102
profile.alterId = [vnext[@" users" ][0 ][@" alterId" ] unsignedIntegerValue ];
99
103
profile.level = [vnext[@" users" ][0 ][@" level" ] unsignedIntegerValue ];
104
+ profile.flow = searchInArray (vnext[@" users" ][0 ][@" flow" ], VLESS_FLOW_LIST);
100
105
profile.security = searchInArray (vnext[@" users" ][0 ][@" security" ], VMESS_SECURITY_LIST);
101
106
if (outboundJson[@" streamSettings" ] != nil ) {
102
107
profile.streamSettings = outboundJson[@" streamSettings" ];
@@ -122,13 +127,14 @@ + (ServerProfile* _Nullable )readFromAnOutboundDic:(NSDictionary*)outDict {
122
127
123
128
-(ServerProfile*)deepCopy {
124
129
ServerProfile* aCopy = [[ServerProfile alloc ] init ];
125
- aCopy.protocol = [ NSString stringWithString: nilCoalescing ( self .protocol, @" " )] ;
130
+ aCopy.protocol = self.protocol ;
126
131
aCopy.address = [NSString stringWithString: nilCoalescing (self .address, @" " )];
127
132
aCopy.port = self.port ;
128
133
aCopy.userId = [NSString stringWithString: nilCoalescing (self .userId, @" " )];
129
134
aCopy.alterId = self.alterId ;
130
135
aCopy.level = self.level ;
131
136
aCopy.outboundTag = [NSString stringWithString: nilCoalescing (self .outboundTag, @" " )];
137
+ aCopy.flow = self.flow ;
132
138
aCopy.security = self.security ;
133
139
aCopy.network = self.network ;
134
140
aCopy.sendThrough = [NSString stringWithString: nilCoalescing (self .sendThrough, @" " )];
@@ -144,7 +150,7 @@ - (NSMutableDictionary*)outboundProfile {
144
150
@{
145
151
@" sendThrough" : sendThrough,
146
152
@" tag" : nilCoalescing (outboundTag, @" " ),
147
- @" protocol" : nilCoalescing ( protocol, @" vmess " ) ,
153
+ @" protocol" : PROTOCOL_LIST[ protocol] ,
148
154
@" settings" : [@{
149
155
@" vnext" : @[
150
156
@{
@@ -154,6 +160,7 @@ - (NSMutableDictionary*)outboundProfile {
154
160
@{
155
161
@" id" : userId != nil ? [userId stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet ]]: @" " ,
156
162
@" alterId" : [NSNumber numberWithUnsignedInteger: alterId],
163
+ @" flow" : VLESS_FLOW_LIST[flow],
157
164
@" security" : VMESS_SECURITY_LIST[security],
158
165
@" level" : [NSNumber numberWithUnsignedInteger: level],
159
166
@" encryption" : @" none"
@@ -181,6 +188,7 @@ - (NSMutableDictionary*)outboundProfile {
181
188
@synthesize alterId;
182
189
@synthesize level;
183
190
@synthesize outboundTag;
191
+ @synthesize flow;
184
192
@synthesize security;
185
193
@synthesize network;
186
194
@synthesize sendThrough;
0 commit comments