Skip to content

Commit

Permalink
v2.4 继续使用Xray核心,并添加了支持SSR协议!
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMRLL authored Jan 14, 2021
1 parent d7cde2d commit 7481784
Show file tree
Hide file tree
Showing 16 changed files with 2,899 additions and 2,310 deletions.
2 changes: 1 addition & 1 deletion default.aproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<project ver="10" name="winXray" libEmbed="true" icon="\app.ico" ui="win" output="winXray.exe" CompanyName="winXray" FileDescription="xray,xray,trojan,shadowsocks 通用客户端" LegalCopyright="Copyright (C) winXray 2020" ProductName="winXray" InternalName="winXray" FileVersion="2.3.0.02" ProductVersion="2.3.0.02" publishDir="\winXray" dstrip="false" local="false">
<project ver="10" name="winXray" libEmbed="true" icon="\app.ico" ui="win" output="winXray.exe" CompanyName="winXray" FileDescription="xray,xray,trojan,shadowsocks 通用客户端" LegalCopyright="Copyright (C) winXray 2020" ProductName="winXray" InternalName="winXray" FileVersion="2.3.0.07" ProductVersion="2.3.0.07" publishDir="\winXray" dstrip="false" local="false">
<file name="main" path="main.aardio"/>
<folder name="窗体" path="forms" comment="" embed="true" local="false">
<folder name="main" path="forms\main" comment="forms\main" local="false" embed="false">
Expand Down
304 changes: 154 additions & 150 deletions lib/config.aardio
Original file line number Diff line number Diff line change
@@ -1,151 +1,155 @@
//config 配置文件
import fsys.config;
config = fsys.config( io.appData("/winXray/") );

namespace config {
__appName = "winXray";
__loadDefaultOutbounds = function(){
import xray.outbounds;
var serverData = ..string.load("/xray-core/winXray-default-servers.json")
: $"/xray-core/winXray-default-servers.json"

proxy.outbounds = ..xray.outbounds.importFromString(..string.removeBom(serverData));
..publish("outbounds.updateConfigJson",)
}

if(!proxy.outbounds){
__loadDefaultOutbounds();
}
}

if(!config.proxy.mode) config.proxy.mode = "pac";
if(!config.proxy.pacPort) config.proxy.pacPort = 0;
if(config.proxy.useHttpGlobal===null){
config.proxy.useHttpGlobal = !_WIN10_LATER;
}

if(config.proxy.enableGitConfigGithub===null){
config.proxy.enableGitConfigGithub = true;
}

if(config.proxy.test === null){
config.proxy.test = true;
}

if(config.proxy.autoRefreshSubscription === null){
config.proxy.autoRefreshSubscription = true;
}

if(!config.proxy.testInterval){
config.proxy.testInterval = 15;
}

if(!config.proxy.maxTestServers){
config.proxy.maxTestServers = 100;
}

if(!config.proxy.subscribeUrls){
config.proxy.subscribeUrls = {
fields = {"";"checked";"ps";"url";}
}
}

config.__resetDefaultCore = function(){
config.core.default = {
inbounds={
{
listen="127.0.0.1";
port=0;
protocol="socks";
settings={
auth="noauth";
udp=true;
};
sniffing={
destOverride={
"http";
"tls"
};
enabled=true
};
tag="proxy";
};
{
listen="127.0.0.1";
port=0;
protocol="http";
settings={};
sniffing={
destOverride={
"http";
"tls"
};
enabled=true
};
tag="http_proxy"
}
};
log={
access="";
error="";
loglevel="warning"
};
outbounds={
{
tag="proxy"
};
{
protocol="freedom";
settings={};
tag="direct";
};
{
protocol="blackhole";
settings={
response={
type="http"
};
};
tag="block";
}
};
routing={
domainStrategy="IPIfNonMatch";
rules={
{
inboundTag={
"api"
};
outboundTag="api";
type="field";
}
}
};
}
}

if(!config.core.default){
config.__resetDefaultCore();
}

if(!config.core.default.inbounds[2]){
config.core.default.inbounds[2] = {
listen="127.0.0.1";
port=0;
protocol="http";
settings={};
sniffing={
destOverride={
"http";
"tls"
};
enabled=true
};
tag="http_proxy"
}
}

/**intellisense(config)
__appName = 应用程序名
? = 配置文件名,\n读写配置并序列化为一个表对象,\n表的成员值可以是支持序列化的普通变量,支持table对象\n配置文件在首次使用时自动加载,退出程序时自动保存\n!fsys_table.
//config 配置文件
import fsys.config;
config = fsys.config( io.appData("/winXray/") );

namespace config {
__appName = "winXray";
__loadDefaultOutbounds = function(){
import xray.outbounds;
var serverData = ..string.load("/xray-core/winXray-default-servers.json")
: $"/xray-core/winXray-default-servers.json"

proxy.outbounds = ..xray.outbounds.importFromString(..string.removeBom(serverData));
..publish("outbounds.updateConfigJson",)
}

if(!proxy.outbounds){
__loadDefaultOutbounds();
}
}

if(!config.proxy.mode) config.proxy.mode = "pac";
if(!config.proxy.pacPort) config.proxy.pacPort = 0;
if(config.proxy.useHttpGlobal===null){
config.proxy.useHttpGlobal = !_WIN10_LATER;
}

if(config.proxy.enableGitConfigGithub===null){
config.proxy.enableGitConfigGithub = true;
}

if(config.proxy.test === null){
config.proxy.test = true;
}

if(config.proxy.autoRefreshSubscription === null){
config.proxy.autoRefreshSubscription = true;
}

if(!config.proxy.testInterval){
config.proxy.testInterval = 15;
}

if(!config.proxy.maxTestServers){
config.proxy.maxTestServers = 100;
}

if(!config.proxy.subscribeUrls){
config.proxy.subscribeUrls = {
fields = {"";"checked";"ps";"url";}
}
}

if(!config.proxy.hotkey){
config.proxy.hotkey = {1/*_MOD_ALT*/|2/*_MOD_CONTROL*/|4/*_MOD_SHIFT*/;'P'#}
}

config.__resetDefaultCore = function(){
config.core.default = {
inbounds={
{
listen="127.0.0.1";
port=0;
protocol="socks";
settings={
auth="noauth";
udp=true;
};
sniffing={
destOverride={
"http";
"tls"
};
enabled=true
};
tag="proxy";
};
{
listen="127.0.0.1";
port=0;
protocol="http";
settings={};
sniffing={
destOverride={
"http";
"tls"
};
enabled=true
};
tag="http_proxy"
}
};
log={
access="";
error="";
loglevel="warning"
};
outbounds={
{
tag="proxy"
};
{
protocol="freedom";
settings={};
tag="direct";
};
{
protocol="blackhole";
settings={
response={
type="http"
};
};
tag="block";
}
};
routing={
domainStrategy="IPIfNonMatch";
rules={
{
inboundTag={
"api"
};
outboundTag="api";
type="field";
}
}
};
}
}

if(!config.core.default){
config.__resetDefaultCore();
}

if(!config.core.default.inbounds[2]){
config.core.default.inbounds[2] = {
listen="127.0.0.1";
port=0;
protocol="http";
settings={};
sniffing={
destOverride={
"http";
"tls"
};
enabled=true
};
tag="http_proxy"
}
}

/**intellisense(config)
__appName = 应用程序名
? = 配置文件名,\n读写配置并序列化为一个表对象,\n表的成员值可以是支持序列化的普通变量,支持table对象\n配置文件在首次使用时自动加载,退出程序时自动保存\n!fsys_table.
end intellisense**/
22 changes: 11 additions & 11 deletions lib/dnsApi.aardio
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//dnsApi 域名解析
namespace dnsApi

_dll = ..raw.loadDll("dnsapi.dll");
flush = function(domain){
return domain ? _dll.DnsFlushResolverCacheB() : _dll.DnsFlushResolverCacheEntry_A(domain);
}

/**intellisense(dnsApi)
flush(.(domain) = 清空指定域名的DNS缓存,\n如果参数不指定域名则清空所有DNS缓存
end intellisense**/
//dnsApi 域名解析
namespace dnsApi
_dll = ..raw.loadDll("dnsapi.dll");
flush = function(domain){
return domain ? _dll.DnsFlushResolverCacheB() : _dll.DnsFlushResolverCacheEntry_A(domain);
}
/**intellisense(dnsApi)
flush(.(domain) = 清空指定域名的DNS缓存,\n如果参数不指定域名则清空所有DNS缓存
end intellisense**/
Loading

0 comments on commit 7481784

Please sign in to comment.