forked from monthlyliaoyuan/Unofficial_Z_Access
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.aardio
143 lines (130 loc) · 4.94 KB
/
main.aardio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import win.ui;
/*DSG{{*/
mainForm = win.form(text="Unofficial_Z_Access";right=757;bottom=467)
mainForm.add()
/*}}*/
var hostline='MAP zh.z-library.se [2606:4700:3033::ac43:aa46]:443,MAP bu2021.xyz [2606:4700:3033::6815:3e2]:443';
var QUICline='zh.z-library.se:443,bu2021.xyz:443';
//var url="https://zh.z-library.se/";
import wsock.tcp.simpleHttpServer;
var url="/web/index.html";
if(_ARGV["c"])
{
import fsys.file;
var cfg;
if(_ARGV["c"]!="")
cfg=fsys.file(_ARGV["c"]);
else
cfg=fsys.file("./CMDconfig.txt");
if(!fsys.file.is(cfg))
{
win.msgboxErr("No Config File! ","ERROR!");
return;
}
hostline=cfg.read();
QUICline=cfg.read();
cfg.close();
}
if(_ARGV["d"])
{
hostline="";
QUICline="";
import fsys.file;
var cfg;
if(_ARGV["d"]!="")
cfg=fsys.file(_ARGV["d"]);
else
cfg=fsys.file("./DOMAINconfig.txt");
if(!fsys.file.is(cfg))
{
win.msgboxErr("No Config File! ","ERROR!");
return;
}
var CFIP=cfg.read();
var d=CFIP;
while(1)
{
d=cfg.read();
if(!d) break;
hostline=hostline+"MAP "+d+" "+CFIP+":443,";
QUICline=QUICline+d+":443,";
}
hostline=string.slice(hostline,1,-2,true);
QUICline=string.slice(QUICline,1,-2,true);
cfg.close();
}
if(_ARGV["g"]) url=_ARGV["g"];
if(_ARGV["h"])
{
url="/help.html";
}
import web.view;
var view=web.view(mainForm,0,'--host-resolver-rules="'+hostline+'" -origin-to-force-quic-on='+QUICline);
view.go("/web/index.html");
mainForm.show();
view.go(url);
return win.loopMessage();
/* You may need:
// from: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/network_session_configurator/common/network_switch_list.h
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file deliberately has no header guard, as it's inlined in a number of
// files.
// no-include-guard-because-multiply-included
// Disables the QUIC protocol.
NETWORK_SWITCH(kDisableQuic, "disable-quic")
// Disables the HTTP/2 protocol.
NETWORK_SWITCH(kDisableHttp2, "disable-http2")
// Enables Alternate-Protocol when the port is user controlled (> 1024).
NETWORK_SWITCH(kEnableUserAlternateProtocolPorts,
"enable-user-controlled-alternate-protocol-ports")
// Enables the QUIC protocol. This is a temporary testing flag.
NETWORK_SWITCH(kEnableQuic, "enable-quic")
// Ignores certificate-related errors.
NETWORK_SWITCH(kIgnoreCertificateErrors, "ignore-certificate-errors")
// Specifies a comma separated list of host-port pairs to force use of QUIC on.
NETWORK_SWITCH(kOriginToForceQuicOn, "origin-to-force-quic-on")
// Disables known-root checks for outgoing WebTransport connections.
NETWORK_SWITCH(kWebTransportDeveloperMode, "webtransport-developer-mode")
// Specifies a comma separated list of QUIC connection options to send to
// the server.
NETWORK_SWITCH(kQuicConnectionOptions, "quic-connection-options")
// Specifies a comma separated list of QUIC client connection options.
NETWORK_SWITCH(kQuicClientConnectionOptions, "quic-client-connection-options")
// Specifies the maximum length for a QUIC packet.
NETWORK_SWITCH(kQuicMaxPacketLength, "quic-max-packet-length")
// Specifies the version of QUIC to use.
NETWORK_SWITCH(kQuicVersion, "quic-version")
// Allows for forcing socket connections to http/https to use fixed ports.
NETWORK_SWITCH(kTestingFixedHttpPort, "testing-fixed-http-port")
NETWORK_SWITCH(kTestingFixedHttpsPort, "testing-fixed-https-port")
// Comma-separated list of rules that control how hostnames are mapped.
//
// For example:
// "MAP * 127.0.0.1" --> Forces all hostnames to be mapped to 127.0.0.1
// "MAP *.google.com proxy" --> Forces all google.com subdomains to be
// resolved to "proxy".
// "MAP test.com [::1]:77 --> Forces "test.com" to resolve to IPv6 loopback.
// Will also force the port of the resulting
// socket address to be 77.
// "MAP * baz, EXCLUDE www.google.com" --> Remaps everything to "baz",
// except for "www.google.com".
//
// These mappings apply to the endpoint host in a net::URLRequest (the TCP
// connect and host resolver in a direct connection, and the CONNECT in an http
// proxy connection, and the endpoint host in a SOCKS proxy connection).
//
// TODO(mmenke): Can we just remove this? host-resolver-rules is more generally
// useful.
NETWORK_SWITCH(kHostRules, "host-rules")
// Enable "greasing" HTTP/2 frame types, that is, sending frames of reserved
// types. See https://tools.ietf.org/html/draft-bishop-httpbis-grease-00 for
// more detail.
NETWORK_SWITCH(kHttp2GreaseFrameType, "http2-grease-frame-type")
// If request has no body, close the stream not by setting END_STREAM flag on
// the HEADERS frame, but by sending an empty DATA frame with END_STREAM
// afterwards. Only affects HTTP/2 request streams, not proxy or bidirectional
// streams.
NETWORK_SWITCH(kHttp2EndStreamWithDataFrame, "http2-end-stream-with-data-frame")
*/