Skip to content

Commit

Permalink
support trojan
Browse files Browse the repository at this point in the history
  • Loading branch information
yanue committed Oct 13, 2020
1 parent 337d4d6 commit bc2b52f
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 52 deletions.
4 changes: 2 additions & 2 deletions Podfile.lock
Expand Up @@ -17,7 +17,7 @@ DEPENDENCIES:
- SwiftyJSON

SPEC REPOS:
https://github.com/CocoaPods/Specs:
https://github.com/CocoaPods/Specs.git:
- Alamofire
- MASShortcut
- QRCoder
Expand Down Expand Up @@ -45,4 +45,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 6196a63d3d6fcd5c461152d1c910391f609a3bba

COCOAPODS: 1.9.3
COCOAPODS: 1.8.4
24 changes: 8 additions & 16 deletions V2rayU.xcodeproj/project.pbxproj
Expand Up @@ -330,7 +330,6 @@
664EB373216C9A5E00B6AE0D /* V2rayU */ = {
isa = PBXGroup;
children = (
669312912413E3A000C043F8 /* trojan */,
66F07CF8236D79540088A4AE /* ping.swift */,
66F411B421CA8921007AAC10 /* cmd.sh */,
6608D9B82182BBAC00A0E0DD /* v2ray */,
Expand Down Expand Up @@ -358,13 +357,6 @@
path = V2rayU;
sourceTree = "<group>";
};
669312912413E3A000C043F8 /* trojan */ = {
isa = PBXGroup;
children = (
);
name = trojan;
sourceTree = "<group>";
};
66AD532D241496EF0070529C /* Common */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -858,7 +850,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = BLHQ787DMR;
DEVELOPMENT_TEAM = RJYEH6TCJD;
INFOPLIST_FILE = V2rayULauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -880,7 +872,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = BLHQ787DMR;
DEVELOPMENT_TEAM = RJYEH6TCJD;
INFOPLIST_FILE = V2rayULauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -1066,13 +1058,13 @@
baseConfigurationReference = 8E15DFCD449143CCC309A1A0 /* Pods-V2rayU.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.3.1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = BLHQ787DMR;
DEVELOPMENT_TEAM = RJYEH6TCJD;
ENABLE_ONLY_ACTIVE_RESOURCES = YES;
INFOPLIST_FILE = V2rayU/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1097,13 +1089,13 @@
baseConfigurationReference = 29B27CD97A6B24986CAF0BFD /* Pods-V2rayU.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.3.1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = BLHQ787DMR;
DEVELOPMENT_TEAM = RJYEH6TCJD;
ENABLE_ONLY_ACTIVE_RESOURCES = YES;
INFOPLIST_FILE = V2rayU/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1128,7 +1120,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = BLHQ787DMR;
DEVELOPMENT_TEAM = RJYEH6TCJD;
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -1140,7 +1132,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = BLHQ787DMR;
DEVELOPMENT_TEAM = RJYEH6TCJD;
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
26 changes: 13 additions & 13 deletions V2rayU/Base.lproj/ConfigWindow.xib
Expand Up @@ -91,7 +91,7 @@
<window title="V2rayU" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" fullSizeContentView="YES"/>
<rect key="contentRect" x="196" y="240" width="597" height="566"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="597" height="566"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down Expand Up @@ -127,7 +127,7 @@
</clipView>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="CcG-vA-eQv">
<rect key="frame" x="1" y="184" width="148" height="15"/>
<rect key="frame" x="1" y="183" width="148" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="aeH-wA-qiH">
Expand Down Expand Up @@ -255,15 +255,15 @@ Gw
<rect key="frame" x="8" y="8" width="377" height="428"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" id="0rS-HW-TeI">
<rect key="frame" x="1" y="1" width="360" height="426"/>
<rect key="frame" x="1" y="1" width="375" height="426"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" selectionGranularity="word" allowsUndo="YES" allowsNonContiguousLayout="YES" textCompletion="NO" smartInsertDelete="YES" id="dNK-7u-GUm">
<rect key="frame" x="0.0" y="0.0" width="364" height="426"/>
<rect key="frame" x="0.0" y="0.0" width="379" height="426"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="alternatingContentBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="360" height="426"/>
<size key="minSize" width="375" height="426"/>
<size key="maxSize" width="400" height="10000000"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
Expand All @@ -275,7 +275,7 @@ Gw
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="PcW-ea-yMr">
<rect key="frame" x="361" y="1" width="15" height="426"/>
<rect key="frame" x="360" y="1" width="16" height="426"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
Expand Down Expand Up @@ -470,13 +470,13 @@ Gw
<menuItem title="vless" id="WU9-bB-1IX">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="shadowsocks" id="5a1-ro-mjU">
<menuItem title="trojan" enabled="NO" id="awP-ro-Z4d">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="socks" id="VGB-NZ-XaQ">
<menuItem title="shadowsocks" id="5a1-ro-mjU">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="trojan" hidden="YES" enabled="NO" id="awP-ro-Z4d">
<menuItem title="socks" id="VGB-NZ-XaQ">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
Expand Down Expand Up @@ -645,7 +645,7 @@ Gw
</subviews>
</view>
<view hidden="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rJI-46-Le8" userLabel="Vless">
<rect key="frame" x="0.0" y="2" width="358" height="140"/>
<rect key="frame" x="0.0" y="0.0" width="358" height="140"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="26f-zo-KeJ">
Expand All @@ -667,7 +667,7 @@ Gw
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DnC-Cl-XHL">
<rect key="frame" x="153" y="47" width="36" height="17"/>
<rect key="frame" x="30" y="47" width="36" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="level:" id="7QY-Ks-X8I">
<font key="font" metaFont="system"/>
Expand Down Expand Up @@ -722,7 +722,7 @@ Gw
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cfE-ED-uw4">
<rect key="frame" x="196" y="44" width="56" height="22"/>
<rect key="frame" x="74" y="44" width="56" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="H4P-sI-pqn">
<numberFormatter key="formatter" formatterBehavior="default10_4" numberStyle="decimal" minimumIntegerDigits="1" maximumIntegerDigits="2000000000" maximumFractionDigits="3" id="RFs-Eg-w0D"/>
Expand Down Expand Up @@ -1754,7 +1754,7 @@ Gw
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="76o-eU-kIf">
<rect key="frame" x="60" y="67" width="62" height="17"/>
<rect key="frame" x="60" y="68" width="62" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="inline" title="show log" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="OQK-lm-eg7">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
Expand Down
20 changes: 17 additions & 3 deletions V2rayU/ConfigWindow.swift
Expand Up @@ -53,7 +53,7 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
@IBOutlet weak var vmessLevel: NSTextField!
@IBOutlet weak var vmessUserId: NSTextField!
@IBOutlet weak var vmessSecurity: NSPopUpButton!

// vless
@IBOutlet weak var vlessAddr: NSTextField!
@IBOutlet weak var vlessPort: NSTextField!
Expand Down Expand Up @@ -270,7 +270,7 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
user.security = self.vmessSecurity.titleOfSelectedItem!
}
v2rayConfig.serverVmess.users[0] = user

// vless
v2rayConfig.serverVless.address = self.vlessAddr.stringValue
v2rayConfig.serverVmess.port = Int(self.vlessPort.intValue)
Expand All @@ -287,6 +287,11 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
v2rayConfig.serverShadowsocks.method = self.shadowsockMethod.titleOfSelectedItem ?? "aes-256-cfb"
}

// trojan
v2rayConfig.serverTrojan.address = self.trojanAddr.stringValue
v2rayConfig.serverTrojan.port = Int(self.trojanPort.intValue)
v2rayConfig.serverTrojan.password = self.trojanPass.stringValue

// socks5
v2rayConfig.serverSocks5.servers[0].address = self.socks5Addr.stringValue
v2rayConfig.serverSocks5.servers[0].port = Int(self.socks5Port.intValue)
Expand Down Expand Up @@ -375,7 +380,7 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
self.vmessUserId.stringValue = user.id
self.vmessSecurity.selectItem(withTitle: user.security)
}

// vless
self.vlessAddr.stringValue = v2rayConfig.serverVless.address
self.vmessPort.intValue = Int32(v2rayConfig.serverVless.port)
Expand All @@ -400,6 +405,15 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
self.socks5User.stringValue = users[0].user
self.socks5Pass.stringValue = users[0].pass
}

// trojan
self.trojanAddr.stringValue = v2rayConfig.serverTrojan.address
self.trojanPass.stringValue = v2rayConfig.serverTrojan.password
if v2rayConfig.serverTrojan.port > 0 {
self.trojanPort.stringValue = String(v2rayConfig.serverTrojan.port)
}


// ========================== server end =======================

// ========================== stream start =======================
Expand Down

0 comments on commit bc2b52f

Please sign in to comment.