123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace App\Http\Controllers\Api\Client;
- use App\Http\Controllers\Controller;
- use File;
- use Illuminate\Http\Request;
- use Symfony\Component\Yaml\Yaml;
- use function Matrix\diagonal;
- class XrayRConfig extends Controller
- {
- public function GetConfig(Request $request){
- $level = $request->input("level");
- $host = $request->input("host");
- $id = $request->input("id");
- $ptype = $request->input("ptype");
- $key = $request->input("key");
- $type = $request->input("type");
- $yaml = <<<EOD
- Log:
- Level: none # Log level: none, error, warning, info, debug
- AccessPath: # /etc/XrayR/access.Log
- ErrorPath: # /etc/XrayR/error.log
- DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.github.io/config/base/dns/ for help
- RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/base/route/ for help
- OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/base/outbound/ for help
- ConnetionConfig:
- Handshake: 4 # Handshake time limit, Second
- ConnIdle: 30 # Connection idle time limit, Second
- UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
- DownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, Second
- BufferSize: 64 # The internal cache size of each connection, kB
- Nodes:
- -
- PanelType: "$ptype" # Panel type: SSpanel, V2board, PMpanel, , Proxypanel
- ApiConfig:
- ApiHost: "$host"
- ApiKey: "$key"
- NodeID: $id
- NodeType: $type # Node type: V2ray, Shadowsocks, Trojan, Shadowsocks-Plugin
- Timeout: 30 # Timeout for the api request
- EnableVless: false # Enable Vless for V2ray Type
- EnableXTLS: false # Enable XTLS for V2ray and Trojan
- SpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disable
- DeviceLimit: 0 # Local settings will replace remote settings, 0 means disable
- RuleListPath: # ./rulelist Path to local rulelist file
- ControllerConfig:
- ListenIP: 0.0.0.0 # IP address you want to listen
- SendIP: 0.0.0.0 # IP address you want to send pacakage
- UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec.
- EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json well
- DNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategy
- EnableProxyProtocol: false # Only works for WebSocket and TCP
- EnableFallback: false # Only support for Trojan and Vless
- FallBackConfigs: # Support multiple fallbacks
- -
- SNI: # TLS SNI(Server Name Indication), Empty for any
- Path: # HTTP PATH, Empty for any
- Dest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/fallback/ for details.
- ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for dsable
- CertConfig:
- CertMode: dns # Option about how to get certificate: none, file, http, dns. Choose "none" will forcedly disable the tls config.
- CertDomain: "node1.test.com" # Domain to cert
- CertFile: ./cert/node1.test.com.cert # Provided if the CertMode is file
- KeyFile: ./cert/node1.test.com.key
- Provider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/
- Email: test@me.com
- DNSEnv: # DNS ENV option used by DNS provider
- ALICLOUD_ACCESS_KEY: aaa
- ALICLOUD_SECRET_KEY: bbb
- EOD;
- // $defaultConfig = base_path().'/resources/rules/config.yml';
- // //$config = [];
- // if (File::exists($defaultConfig)) {
- // $config = yaml_parse_file($defaultConfig);
- // }
- //https://api.ruanjian.buzz/api/client/v1/getConfig?level=debug&ptype=Proxypanel&host=http://apitx.naiyout.buzz&key=p47fTOcWKOvKuZBP&id=22&type=Shadowsocks
- //var_dump(urlencode("http://apitx.naiyout.buzz"));
- // $config["Log"]["Level"] = $request->input("level");
- // $config["Nodes"][0]["PanelType"] = $ptype;
- // $config["Nodes"][0]["ApiConfig"]["ApiHost"] = $host;
- // $config["Nodes"][0]["ApiConfig"]["ApiKey"] = $key;
- // $config["Nodes"][0]["ApiConfig"]["NodeID"] = (int)$id;
- // $config["Nodes"][0]["ApiConfig"]["NodeType"] = $type;
- echo $yaml;
- die();
- return Yaml::dump($config,6,4,0);
- }
- }
|