This commit is contained in:
2022-12-19 19:49:52 +08:00
parent 106cd124f4
commit 791e0b68bf
112 changed files with 12175 additions and 992 deletions
+20
View File
@@ -0,0 +1,20 @@
# webman
High performance HTTP Service Framework for PHP based on [Workerman](https://github.com/walkor/workerman).
# Manual (文档)
https://www.workerman.net/doc/webman
# Home page (主页)
https://www.workerman.net/webman
# Benchmarks (压测)
https://www.techempower.com/benchmarks/#section=test&runid=9716e3cd-9e53-433c-b6c5-d2c48c9593c1&hw=ph&test=db&l=zg24n3-1r&a=2
![image](https://user-images.githubusercontent.com/6073368/96447814-120fc980-1245-11eb-938d-6ea408716c72.png)
## LICENSE
MIT
+34
View File
@@ -0,0 +1,34 @@
# webman
High performance HTTP Service Framework for PHP based on [Workerman](https://github.com/walkor/workerman).
# Manual (文档)
https://www.workerman.net/doc/webman
# Home page (主页)
https://www.workerman.net/webman
# Benchmarks (压测)
https://www.techempower.com/benchmarks/#section=test&runid=9716e3cd-9e53-433c-b6c5-d2c48c9593c1&hw=ph&test=db&l=zg24n3-1r&a=2
![image](https://user-images.githubusercontent.com/6073368/96447814-120fc980-1245-11eb-938d-6ea408716c72.png)
## LICENSE
MIT
```php
>nslookup test.com 127.0.0.1
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: test.com
Address: 119.29.29.29
Name: test.com
Address: 8.8.8.8
```
@@ -0,0 +1,41 @@
<?php
namespace app\controller;
include_once base_path().'/vendor/laysense/dns/src/resource/ipv6.php';
use dnstools\ipv6; #用于IPv6相关
/**
* $ipv6=new IPv6;
* $ipv6->ip2bin($ip);
*/
class DnsController
{
public function DNS($type,$name,$rip,$id,$query)
{
#输出信息
#echo "\n Type:$type \n Domain: $name\n Client IP: $rip \n";
#此处请根据业务需要,通过判断$name和$rip返回正确的数据
#详情请参见 https://github.com/ywnsya/workerman-dns 尤其是 https://github.com/ywnsya/Workerman-DNS/blob/master/start.php 中的用法
if($type=='PTR'){
$send['detail']='dns.laysense.com';
$send['ttl']=30;
$send['type']='PTR';
}
if($type=='A' && $name=='test.n2n.icu'){
$send['type']='A';
$send['detail'][1]='119.29.29.29';
$send['detail'][2]='8.8.8.8';
$send['ttl']=30;
}
#此处无需修改
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
}
@@ -0,0 +1,39 @@
<?php
namespace app\controller;
include_once base_path().'/vendor/laysense/dns/src/resource/ipv6.php';
use dnstools\ipv6; #用于IPv6相关
/**
* $ipv6=new IPv6;
* $ipv6->ip2bin($ip);
*/
class DnsController
{
public function DNS($type,$name,$rip,$id,$query)
{
#输出信息
#echo "\n Type:$type \n Domain: $name\n Client IP: $rip \n";
#此处请根据业务需要,通过判断$name和$rip返回正确的数据
#详情请参见 https://github.com/ywnsya/workerman-dns 尤其是 https://github.com/ywnsya/Workerman-DNS/blob/master/start.php 中的用法
if($type=='PTR'){
$send['detail']='dns.laysense.com';
$send['ttl']=30;
$send['type']='PTR';
}else{
$send['type']='A';
$send['detail'][1]='119.29.29.29';
$send['detail'][2]='8.8.8.8';
$send['ttl']=30;
}
#此处无需修改
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
}
@@ -0,0 +1,47 @@
<?php
namespace app\controller;
include_once base_path().'/vendor/laysense/dns/src/resource/ipv6.php';
use dnstools\ipv6; #用于IPv6相关
/**
* $ipv6=new IPv6;
* $ipv6->ip2bin($ip);
*/
class DnsController
{
public function DNS($type,$name,$rip,$id,$query)
{
#输出信息
#echo "\n Type:$type \n Domain: $name\n Client IP: $rip \n";
#此处请根据业务需要,通过判断$name和$rip返回正确的数据
#详情请参见 https://github.com/ywnsya/workerman-dns 尤其是 https://github.com/ywnsya/Workerman-DNS/blob/master/start.php 中的用法
if($type=='PTR'){
$send['detail']='dns.laysense.com';
$send['ttl']=30;
$send['type']='PTR';
}
if($type=='A'){
$send['type']='A';
$send['detail'][1]='119.29.29.29';
$send['detail'][2]='8.8.8.8';
$send['ttl']=30;
};
if($type=='AAAA'){
$ipv6=new IPv6;
$send['type']='AAAA';
$send['detail'][1]=bin2hex($ipv6->ip2bin("fe80::2c5f")); #此操作可以还原被简化的IPv6地址 协议内不再对IPv6地址进行处理,请按照本方式传递16进制无":"的完整16位IPv6
$send['detail'][2]=bin2hex($ipv6->ip2bin("2001:0:2851:b9d0:2c5f:f0d9:21be:4b96"));
$send['ttl']=600;
}
#此处无需修改
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
}
@@ -0,0 +1,21 @@
<?php
namespace app\controller;
include_once base_path().'/vendor/laysense/dns/src/resource/ipv6.php';
use dnstools\ipv6; #用于IPv6相关
$ipv6=new IPv6;
$ipv6->ip2bin($ip);
class DnsController
{
public function DNS($type,$name,$rip,$id,$query)
{
#此处无需修改
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
}
@@ -0,0 +1,21 @@
<?php
namespace app\controller;
include_once base_path().'/vendor/laysense/dns/src/resource/ipv6.php';
use dnstools\ipv6; #用于IPv6相关
class DnsController
{
public function DNS($type,$name,$rip,$id,$query)
{
$ipv6=new IPv6;
$ipv6->ip2bin($ip);
#此处无需修改
$send['id']=$id;
$send['query']=$query;
$return=json_encode($send);
return $return;
}
}
+59
View File
@@ -0,0 +1,59 @@
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "https://www.workerman.net",
"license": "MIT",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "https://www.workerman.net",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.4.3",
"monolog/monolog": "^2.0",
"webman/console": "^1.2",
"geoip2/geoip2": "~2.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"Laysense\\Dns\\" : "vendor/laysense/dns/src",
"": "./",
"app\\": "./app",
"App\\": "./app",
"app\\View\\Components\\": "./app/view/components"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
+59
View File
@@ -0,0 +1,59 @@
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "https://www.workerman.net",
"license": "AGPLv3",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "https://www.workerman.net",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.4.3",
"monolog/monolog": "^2.0",
"webman/console": "^1.2",
"geoip2/geoip2": "~2.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"Laysense\\Dns\\" : "vendor/laysense/dns/src",
"": "./",
"app\\": "./app",
"App\\": "./app",
"app\\View\\Components\\": "./app/view/components"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
+60
View File
@@ -0,0 +1,60 @@
{
"name": "laysense/highspeaker",
"type": "project",
"keywords": [
"DNS server",
"DNS service",
"workerman"
],
"homepage": "https://laysense.com/dns",
"license": "AGPL-3.0-or-later",
"description": "A Dns server written by PHP based on Workerman",
"authors": [
{
"name": "Laysense",
"email": "enoch@laysense.com",
"homepage": "https://laysense.com",
"role": "Developer"
}
],
"support": {
"email": "enoch@laysense.com",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.4.3",
"monolog/monolog": "^2.0",
"webman/console": "^1.2",
"geoip2/geoip2": "~2.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"Laysense\\Dns\\" : "vendor/laysense/dns/src",
"": "./",
"app\\": "./app",
"App\\": "./app",
"app\\View\\Components\\": "./app/view/components"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
+60
View File
@@ -0,0 +1,60 @@
{
"name": "laysense/highspeaker",
"type": "project",
"keywords": [
"DNS server",
"DNS service",
"workerman"
],
"homepage": "https://laysense.com/dns",
"license": "AGPL-3.0-or-later",
"description": "A Dns server written by PHP based on Workerman",
"authors": [
{
"name": "Laysense",
"email": "enoch@laysense.com",
"homepage": "https://laysense.com",
"role": "Developer"
}
],
"support": {
"email": "enoch@laysense.com",
"issues": "https://git.laysense.com/enoch/HighSpeaker/issues",
"forum": "https://git.laysense.com/enoch/HighSpeaker/issues",
"wiki": "https://doc.laysense.com/web/#/5/23",
"source": "https://git.laysense.com/enoch/HighSpeaker/"
},
"require": {
"php": ">=8.0",
"workerman/webman-framework": "^1.4.3",
"monolog/monolog": "^2.0",
"webman/console": "^1.2",
"geoip2/geoip2": "~2.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"Laysense\\Dns\\" : "vendor/laysense/dns/src",
"": "./",
"app\\": "./app",
"App\\": "./app",
"app\\View\\Components\\": "./app/view/components"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
@@ -0,0 +1,42 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Workerman\Worker;
return [
// File update detection and automatic reload
'monitor' => [
'handler' => process\Monitor::class,
'reloadable' => false,
'constructor' => [
// Monitor these directories
'monitor_dir' => array_merge([
app_path(),
config_path(),
base_path() . '/process',
base_path() . '/support',
base_path() . '/resource',
base_path() . '/.env',
], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
// Files with these suffixes will be monitored
'monitor_extensions' => [
'php', 'html', 'htm', 'env'
],
'options' => [
'enable_file_monitor' => !Worker::$daemonize && DIRECTORY_SEPARATOR === '/',
'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
]
]
]
];
@@ -0,0 +1,50 @@
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Workerman\Worker;
return [
// File update detection and automatic reload
'monitor' => [
'handler' => process\Monitor::class,
'reloadable' => false,
'constructor' => [
// Monitor these directories
'monitor_dir' => array_merge([
app_path(),
config_path(),
base_path() . '/process',
base_path() . '/support',
base_path() . '/resource',
base_path() . '/.env',
], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
// Files with these suffixes will be monitored
'monitor_extensions' => [
'php', 'html', 'htm', 'env'
],
'options' => [
'enable_file_monitor' => !Worker::$daemonize && DIRECTORY_SEPARATOR === '/',
'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
]
]
],
'Dns' => [
'handler' => process\DnsProcess::class,
'listen' => 'Dns://0.0.0.0:53',
'transport' => 'udp',
'count' => cpu_count() * 4
],
];