Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"public_port"=> 4000,//服务端口
"CLUSTER_ID"=> "",
"CLUSTER_SECRET"=> "",
"byoc"=>false,
],
"file"=> [
"cache_dir"=> "./cache",//缓存文件夹
Expand Down
4 changes: 4 additions & 0 deletions inc/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ public function startserver() {
else{
$url = $request->server['request_uri']."?".$request->server['query_string'];
}
//真的会有启动器不带ua的啊,太神奇了
if(!isset($request->server['user-agent'])){
$request->server['user-agent'] = "other";
}
mlog(" Serve {$code} | {$request->server['remote_addr']} | {$request->server['server_protocol']} | {$url} | {$request->header['user-agent']};") ;
});
$server->handle('/measure', function ($request, $response) {
Expand Down
4 changes: 2 additions & 2 deletions inc/socketio.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function ack($event,$data = "") {
public function Getclient() {
return $this->client;
}
public function enable($host,$port) {
public function enable($host,$port,$byoc) {
if (in_array($host, ["0.0.0.0", "127.0.0.1"])){
$host = preg_replace('/\R/', '', file_get_contents('http://ip.3322.net'));
}
Expand All @@ -151,7 +151,7 @@ public function enable($host,$port) {
'host' => $host,
'port' => $port,
'version' => VERSION,
'byoc' => false,
'byoc' => $byoc,
'noFastEnable' => false,
'flavor' =>[
'runtime' => 'PHP-'.substr(PHP_VERSION,0,3).'/'.php_uname('s'),
Expand Down
6 changes: 4 additions & 2 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
use function Swoole\Coroutine\run;
use function Swoole\Timer;
declare(ticks=1)
set_time_limit(0);
ini_set('memory_limit', '-1');
require './config.php';
const PHPOBAVERSION = '1.2.0';
const PHPOBAVERSION = '1.3.0';
const VERSION = '1.10.4';
global $DOWNLOAD_DIR;
$DOWNLOAD_DIR = $config['file']['cache_dir'];
Expand Down Expand Up @@ -135,6 +137,6 @@ function registerSigintHandler() {
Coroutine::create(function () use ($config,$httpserver){
$httpserver->startserver();
});
$socketio->enable($config['cluster']['public_host'],$config['cluster']['public_port']);
$socketio->enable($config['cluster']['public_host'],$config['cluster']['public_port'],$config['cluster']['byoc']);
}
});