Compare commits

..

2 Commits

Author SHA1 Message Date
xboard
7fdc2bf84f feat: add postgresql support
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
2025-01-21 03:09:44 +08:00
xboard
3ab7d6cd53 fix: vmess subscribe for loon 2025-01-21 02:34:18 +08:00
5 changed files with 24 additions and 25 deletions

View File

@ -89,40 +89,39 @@ class Loon implements ProtocolInterface
if (data_get($protocol_settings, 'tls')) {
if (data_get($protocol_settings, 'network') === 'tcp')
array_push($config, 'over-tls=true');
$config[] = 'over-tls=true';
if (data_get($protocol_settings, 'tls_settings')) {
$tls_settings = data_get($protocol_settings, 'tls_settings');
if (data_get($tls_settings, 'allow_insecure'))
array_push($config, 'skip-cert-verify=' . ($tls_settings['allow_insecure'] ? 'true' : 'false'));
$config[] = 'skip-cert-verify=' . ($tls_settings['allow_insecure'] ? 'true' : 'false');
if (data_get($tls_settings, 'server_name'))
array_push($config, "tls-name={$tls_settings['server_name']}");
$config[] = "tls-name={$tls_settings['server_name']}";
}
}
switch (data_get($server['protocol_settings'], 'network')) {
case 'tcp':
array_push($config, 'transport=tcp');
$config[] = 'transport=tcp';
$tcpSettings = data_get($protocol_settings, 'network_settings');
if (data_get($protocol_settings, 'network_settings')['header']['type'])
if (data_get($tcpSettings, 'header.type'))
$config = str_replace('transport=tcp', "transport={$tcpSettings['header']['type']}", $config);
if (data_get($tcpSettings, key: 'header.request.path')) {
$paths = data_get($tcpSettings, key: 'header.request.path');
$path = $paths[array_rand($paths)];
array_push($config, "path={$path}");
$config[] = "path={$path}";
}
if (data_get($tcpSettings, key: 'header.request.headers.Host')) {
$hosts = data_get($tcpSettings, key: 'header.request.headers.Host');
$host = $hosts[array_rand($hosts)];
array_push($config, "host={$host}");
$config[] = "host={$host}";
}
break;
case 'ws':
array_push($config, 'transport=ws');
$config[] = 'transport=ws';
$wsSettings = data_get($protocol_settings, 'network_settings');
if (data_get($wsSettings, key: 'path'))
array_push($config, "path={$wsSettings['path']}");
$config[] = "path={$wsSettings['path']}";
if (data_get($wsSettings, key: 'headers.Host'))
array_push($config, "host={$wsSettings['headers']['Host']}");
$config[] = "host={$wsSettings['headers']['Host']}";
break;
@ -146,7 +145,7 @@ class Loon implements ProtocolInterface
'udp=true'
];
if (!empty($protocol_settings['allow_insecure'])) {
array_push($config, data_get($protocol_settings, 'allow_insecure') ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
$config[] = data_get($protocol_settings, 'allow_insecure') ? 'skip-cert-verify=true' : 'skip-cert-verify=false';
}
$config = array_filter($config);
$uri = implode(',', $config);

View File

@ -72,7 +72,7 @@ return new class extends Migration {
$table->integer('three_year_price')->nullable();
$table->integer('onetime_price')->nullable();
$table->integer('reset_price')->nullable();
$table->boolean('reset_traffic_method')->nullable()->comment('重置流量方式:0跟随系统设置、1每月1号、2按月重置、3不重置、4每年1月1日、5按年重置');
$table->integer('reset_traffic_method')->nullable()->comment('重置流量方式:0跟随系统设置、1每月1号、2按月重置、3不重置、4每年1月1日、5按年重置');
$table->integer('capacity_limit')->nullable();
$table->integer('created_at');
$table->integer('updated_at');
@ -264,8 +264,8 @@ return new class extends Migration {
$table->integer('refund_amount')->nullable()->comment('退款金额');
$table->integer('balance_amount')->nullable()->comment('使用余额');
$table->text('surplus_order_ids')->nullable()->comment('折抵订单');
$table->boolean('status')->default(false)->comment('0待支付1开通中2已取消3已完成4已折抵');
$table->boolean('commission_status')->default(false)->comment('0待确认1发放中2有效3无效');
$table->integer('status')->default(0)->comment('0待支付1开通中2已取消3已完成4已折抵');
$table->integer('commission_status')->default(false)->comment('0待确认1发放中2有效3无效');
$table->integer('commission_balance')->default(0);
$table->integer('actual_commission_balance')->nullable()->comment('实际支付佣金');
$table->integer('paid_at')->nullable();
@ -299,7 +299,7 @@ return new class extends Migration {
$table->integer('id', true);
$table->string('code');
$table->string('name');
$table->boolean('type');
$table->integer('type');
$table->integer('value');
$table->boolean('show')->default(false);
$table->integer('limit_use')->nullable();
@ -333,9 +333,9 @@ return new class extends Migration {
$table->integer('id', true);
$table->integer('user_id');
$table->string('subject');
$table->boolean('level');
$table->boolean('status')->default(false)->comment('0:已开启 1:已关闭');
$table->boolean('reply_status')->default(true)->comment('0:待回复 1:已回复');
$table->integer('level');
$table->integer('status')->default(0)->comment('0:已开启 1:已关闭');
$table->integer('reply_status')->default(1)->comment('0:待回复 1:已回复');
$table->integer('created_at');
$table->integer('updated_at');
});
@ -421,7 +421,7 @@ return new class extends Migration {
$table->string('host');
$table->integer('port');
$table->integer('server_port');
$table->boolean('tls');
$table->integer('tls');
$table->text('tls_settings')->nullable();
$table->string('flow', 64)->nullable();
$table->string('network', 11);

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('v2_order', function (Blueprint $table) {
$table->boolean('commission_status')->nullable()->default(null)->comment('0待确认1发放中2有效3无效')->change();
$table->integer('commission_status')->nullable()->default(null)->comment('0待确认1发放中2有效3无效')->change();
});
}
@ -22,7 +22,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('v2_order', function (Blueprint $table) {
$table->boolean('commission_status')->default(false)->comment('0待确认1发放中2有效3无效')->change();
$table->integer('commission_status')->default(false)->comment('0待确认1发放中2有效3无效')->change();
});
}
};

View File

@ -51,7 +51,7 @@ return new class extends Migration {
->comment('Transfer limit in bytes')->change();
$table->unsignedInteger('speed_limit')->nullable()
->comment('Speed limit in Mbps, 0 for unlimited')->change();
$table->unsignedSmallInteger('reset_traffic_method')->nullable()->default(0)
$table->integer('reset_traffic_method')->nullable()->default(0)
->comment('重置流量方式:0跟随系统设置、1每月1号、2按月重置、3不重置、4每年1月1日、5按年重置')->change();
$table->unsignedInteger('capacity_limit')->nullable()->default(0)
->comment('0 for unlimited')->change();

View File

@ -16,7 +16,7 @@ return new class extends Migration
'commission_status' => 0
]);
Schema::table('v2_order', function (Blueprint $table) {
$table->boolean('commission_status')->default(value: 0)->comment('0待确认1发放中2有效3无效')->change();
$table->integer('commission_status')->default(value: 0)->comment('0待确认1发放中2有效3无效')->change();
});
}
@ -27,7 +27,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('v2_order', function (Blueprint $table) {
$table->boolean('commission_status')->nullable()->comment('0待确认1发放中2有效3无效')->change();
$table->integer('commission_status')->nullable()->comment('0待确认1发放中2有效3无效')->change();
});
}
};