Browse Source

add server rules

Tokumeikoi 5 years ago
parent
commit
19fd19fbcf
1 changed files with 20 additions and 0 deletions
  1. 20 0
      app/Http/Controllers/Server/DeepbworkController.php

+ 20 - 0
app/Http/Controllers/Server/DeepbworkController.php

@@ -142,6 +142,26 @@ class DeepbworkController extends Controller
                     break;
             }
         }
+
+        if ($server->rules) {
+            $rules = json_decode($server->rules);
+            // domain
+            $domainObj = new \StdClass();
+            $domainObj->type = 'field';
+            $domainObj->domain = $rules->domain;
+            $domainObj->outboundTag = 'block';
+            // protocol
+            $protocolObj = new \StdClass();
+            $protocolObj->type = 'field';
+            $protocolObj->protocol = $rules->protocol;
+            $protocolObj->outboundTag = 'block';
+            array_push(
+                $json->routing->settings->rules,
+                $domainObj,
+                $protocolObj
+            );
+        }
+
         if ((int)$server->tls) {
             $json->inbound->streamSettings->security = 'tls';
             $tls = (object)[