Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit ca8e007

Browse files
authored
Merge pull request #159 from Chandler-Lu/master
Tcp Fast Open Supported, resolves #156
2 parents 972f791 + ce65dbd commit ca8e007

File tree

5 files changed

+63
-35
lines changed

5 files changed

+63
-35
lines changed

V2RayX/ConfigWindowController.h

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
@property (weak) IBOutlet NSButton *muxEnableButton;
5959
@property (weak) IBOutlet NSTextField *muxConcurrencyField;
6060

61+
//tcp fast open
62+
@property (weak) IBOutlet NSButton *tfoEnableButton;
63+
6164
//proxy fields
6265
@property (weak) IBOutlet NSTextField *proxyAddressField;
6366
@property (weak) IBOutlet NSTextField *proxyPortField;

V2RayX/ConfigWindowController.m

+16-2
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ - (IBAction)showTransportSettings:(id)sender {
312312
NSDictionary *muxSettings = [self.selectedProfile muxSettings];
313313
[_muxEnableButton setState:[nilCoalescing(muxSettings[@"enabled"], @NO) boolValue]];
314314
[_muxConcurrencyField setIntegerValue:[nilCoalescing(muxSettings[@"concurrency"], @8) integerValue]];
315+
// tcp fast open
316+
NSDictionary* tfoSettings = [transportSettings objectForKey:@"sockopt"];
317+
[_tfoEnableButton setState:[tfoSettings[@"tcpFastOpen"] boolValue]];
315318
// proxy
316319
/*
317320
NSDictionary *proxySettings = [selectedProfile proxySettings];
@@ -347,6 +350,8 @@ - (IBAction)tReset:(id)sender {
347350
//mux fields
348351
[_muxEnableButton setState:0];
349352
[_muxEnableButton setIntegerValue:8];
353+
//tcp fast open
354+
[_tfoEnableButton setState:0];
350355
//outbound proxy
351356
[_proxyPortField setIntegerValue:0];
352357
[_proxyAddressField setStringValue:@""];
@@ -408,6 +413,14 @@ - (IBAction)tOK:(id)sender {
408413
} else {
409414
httpSettings = @{ @"path": nilCoalescing([self->_httpPathField stringValue], @"") };
410415
}
416+
NSDictionary *sockopt;
417+
if ([self->_tfoEnableButton state]) {
418+
sockopt = @{
419+
@"tcpFastOpen": [NSNumber numberWithBool:[self->_tfoEnableButton state] == 1]
420+
};
421+
} else {
422+
sockopt = @{};
423+
}
411424
NSDictionary *streamSettings =
412425
@{@"kcpSettings":
413426
@{@"mtu":[NSNumber numberWithInteger:[self->_kcpMtuField integerValue]],
@@ -427,9 +440,10 @@ - (IBAction)tOK:(id)sender {
427440
@"security": [self->_tlsUseButton state] ? @"tls" : @"none",
428441
@"tlsSettings": @{
429442
@"serverName": nilCoalescing([self->_tlsSnField stringValue], @""),
430-
@"allowInsecure": [NSNumber numberWithBool:[self->_tlsAiButton state]==1],
443+
@"allowInsecure": [NSNumber numberWithBool:[self->_tlsAiButton state]==1]
431444
},
432-
@"httpSettings": httpSettings
445+
@"httpSettings": httpSettings,
446+
@"sockopt": sockopt
433447
};
434448
NSDictionary* muxSettings = @{
435449
@"enabled":[NSNumber numberWithBool:[self->_muxEnableButton state]==1],

V2RayX/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>309</string>
24+
<string>315</string>
2525
<key>LSMinimumSystemVersion</key>
2626
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2727
<key>LSUIElement</key>

V2RayX/ServerProfile.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ - (ServerProfile*)init {
5252
}
5353
},
5454
@"httpSettings": @{
55-
@"host": @[@"server.cc"],
56-
@"path": @""
55+
@"host": @[@"server.cc"],
56+
@"path": @""
5757
}
5858
}];
5959
[self setMuxSettings:@{

0 commit comments

Comments
 (0)