SsNode.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Builder;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * SS节点信息
  7. *
  8. * @property int $id
  9. * @property int $type 服务类型:1-ShadowsocksR、2-V2ray
  10. * @property string $name 名称
  11. * @property string|null $country_code 国家代码
  12. * @property string|null $server 服务器域名地址
  13. * @property string|null $ip 服务器IPV4地址
  14. * @property string|null $ipv6 服务器IPV6地址
  15. * @property string|null $relay_server 中转地址
  16. * @property int|null $relay_port 中转端口
  17. * @property int $level 等级:0-无等级,全部可见
  18. * @property int $speed_limit 节点限速,为0表示不限速,单位Byte
  19. * @property int $client_limit 设备数限制
  20. * @property string|null $description 节点简单描述
  21. * @property string $method 加密方式
  22. * @property string $protocol 协议
  23. * @property string|null $protocol_param 协议参数
  24. * @property string $obfs 混淆
  25. * @property string|null $obfs_param 混淆参数
  26. * @property float $traffic_rate 流量比率
  27. * @property int $is_subscribe 是否允许用户订阅该节点:0-否、1-是
  28. * @property int $is_ddns 是否使用DDNS:0-否、1-是
  29. * @property int $is_relay 是否中转节点:0-否、1-是
  30. * @property int $is_udp 是否启用UDP:0-不启用、1-启用
  31. * @property int $push_port 消息推送端口
  32. * @property int $detection_type 节点检测: 0-关闭、1-只检测TCP、2-只检测ICMP、3-检测全部
  33. * @property int $compatible 兼容SS
  34. * @property int $single 启用单端口功能:0-否、1-是
  35. * @property int|null $port 单端口的端口号或连接端口号
  36. * @property string|null $passwd 单端口的连接密码
  37. * @property int $sort 排序值,值越大越靠前显示
  38. * @property int $status 状态:0-维护、1-正常
  39. * @property int $v2_alter_id V2Ray额外ID
  40. * @property int $v2_port V2Ray服务端口
  41. * @property string $v2_method V2Ray加密方式
  42. * @property string $v2_net V2Ray传输协议
  43. * @property string $v2_type V2Ray伪装类型
  44. * @property string $v2_host V2Ray伪装的域名
  45. * @property string $v2_path V2Ray的WS/H2路径
  46. * @property int $v2_tls V2Ray连接TLS:0-未开启、1-开启
  47. * @property string|null $tls_provider V2Ray节点的TLS提供商授权信息
  48. * @property \Illuminate\Support\Carbon $created_at
  49. * @property \Illuminate\Support\Carbon $updated_at
  50. * @property-read \App\Models\NodeAuth|null $auth
  51. * @property-read mixed $type_label
  52. * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\SsNodeLabel[] $label
  53. * @property-read int|null $label_count
  54. * @method static Builder|SsNode newModelQuery()
  55. * @method static Builder|SsNode newQuery()
  56. * @method static Builder|SsNode query()
  57. * @method static Builder|SsNode whereClientLimit($value)
  58. * @method static Builder|SsNode whereCompatible($value)
  59. * @method static Builder|SsNode whereCountryCode($value)
  60. * @method static Builder|SsNode whereCreatedAt($value)
  61. * @method static Builder|SsNode whereDescription($value)
  62. * @method static Builder|SsNode whereDetectionType($value)
  63. * @method static Builder|SsNode whereId($value)
  64. * @method static Builder|SsNode whereIp($value)
  65. * @method static Builder|SsNode whereIpv6($value)
  66. * @method static Builder|SsNode whereIsDdns($value)
  67. * @method static Builder|SsNode whereIsRelay($value)
  68. * @method static Builder|SsNode whereIsSubscribe($value)
  69. * @method static Builder|SsNode whereIsUdp($value)
  70. * @method static Builder|SsNode whereLevel($value)
  71. * @method static Builder|SsNode whereMethod($value)
  72. * @method static Builder|SsNode whereName($value)
  73. * @method static Builder|SsNode whereObfs($value)
  74. * @method static Builder|SsNode whereObfsParam($value)
  75. * @method static Builder|SsNode wherePasswd($value)
  76. * @method static Builder|SsNode wherePort($value)
  77. * @method static Builder|SsNode whereProtocol($value)
  78. * @method static Builder|SsNode whereProtocolParam($value)
  79. * @method static Builder|SsNode wherePushPort($value)
  80. * @method static Builder|SsNode whereRelayPort($value)
  81. * @method static Builder|SsNode whereRelayServer($value)
  82. * @method static Builder|SsNode whereServer($value)
  83. * @method static Builder|SsNode whereSingle($value)
  84. * @method static Builder|SsNode whereSort($value)
  85. * @method static Builder|SsNode whereSpeedLimit($value)
  86. * @method static Builder|SsNode whereStatus($value)
  87. * @method static Builder|SsNode whereTlsProvider($value)
  88. * @method static Builder|SsNode whereTrafficRate($value)
  89. * @method static Builder|SsNode whereType($value)
  90. * @method static Builder|SsNode whereUpdatedAt($value)
  91. * @method static Builder|SsNode whereV2AlterId($value)
  92. * @method static Builder|SsNode whereV2Host($value)
  93. * @method static Builder|SsNode whereV2Method($value)
  94. * @method static Builder|SsNode whereV2Net($value)
  95. * @method static Builder|SsNode whereV2Path($value)
  96. * @method static Builder|SsNode whereV2Port($value)
  97. * @method static Builder|SsNode whereV2Tls($value)
  98. * @method static Builder|SsNode whereV2Type($value)
  99. * @mixin \Eloquent
  100. */
  101. class SsNode extends Model {
  102. protected $table = 'ss_node';
  103. protected $primaryKey = 'id';
  104. function label() {
  105. return $this->hasMany(SsNodeLabel::class, 'node_id', 'id');
  106. }
  107. function auth() {
  108. return $this->hasOne(NodeAuth::class, 'node_id', 'id');
  109. }
  110. function getLevel() {
  111. return $this->hasOne(Level::class, 'level', 'level');
  112. }
  113. function getTypeLabelAttribute() {
  114. switch($this->attributes['type']){
  115. case 1:
  116. $type_label = 'ShadowsocksR';
  117. break;
  118. case 2:
  119. $type_label = 'V2Ray';
  120. break;
  121. case 3:
  122. $type_label = 'Trojan';
  123. break;
  124. default:
  125. $type_label = 'UnKnown';
  126. }
  127. return $type_label;
  128. }
  129. }