This commit is contained in:
2026-04-17 14:41:13 +08:00
parent e5ab97dd5a
commit 4ae3001fe3
4 changed files with 277 additions and 212 deletions
+14 -60
View File
@@ -4,76 +4,30 @@ namespace Coroutine\Server;
class Config
{
public string $host = '0.0.0.0';
public int $port {
get => $this->port;
public int $port = 9501;
set(int $value) {
$this->port = $value;
}
}
public string $authKey = 'access_token';
public int $writeTimeout = 0;
public string $host {
get => $this->host;
public int $maxCoroutine = 100000;
public int $readTimeout = 0;
set(string $value) {
$this->host = $value;
}
}
public int $maxPackageSize = 2097152;
public int $maxFrameSize = 2097152;
public string $authKey {
get => $this->authKey;
public bool $exposeOnlineLists = false;
set(string $value) {
$this->authKey = $value;
}
}
public string $websocketPath = '/websocket';
public string $onlineListPath = '/online/lists';
public int $writeTimeout {
get => $this->writeTimeout;
set(int $value) {
$this->writeTimeout = $value;
}
}
public int $maxCoroutine {
get => $this->maxCoroutine;
set(int $value) {
$this->maxCoroutine = $value;
}
}
public int $readTimeout {
get => $this->readTimeout;
set(int $value) {
$this->readTimeout = $value;
}
}
public int $maxPackageSize {
get => $this->maxPackageSize;
set(int $value) {
$this->maxPackageSize = $value;
}
}
public int $maxFrameSize {
get => $this->maxFrameSize;
set(int $value) {
$this->maxFrameSize = $value;
}
public function normalizePath(string $path): string
{
return '/' . ltrim($path, '/');
}
}