mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 12:20:27 +08:00
阶段性提交
This commit is contained in:
4
build/grpc.sh
Executable file
4
build/grpc.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rm -f ../internal/rpc/pb/*
|
||||
protoc --go_out=plugins=grpc:../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/*.proto
|
||||
12
go.mod
Normal file
12
go.mod
Normal file
@@ -0,0 +1,12 @@
|
||||
module github.com/TeaOSLab/EdgeCommon
|
||||
|
||||
go 1.15
|
||||
|
||||
require (
|
||||
github.com/go-yaml/yaml v2.1.0+incompatible
|
||||
github.com/golang/protobuf v1.4.2
|
||||
github.com/iwind/TeaGo v0.0.0-20200910072805-729cffe36729
|
||||
google.golang.org/grpc v1.32.0
|
||||
google.golang.org/protobuf v1.25.0
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
|
||||
)
|
||||
166
go.sum
Normal file
166
go.sum
Normal file
@@ -0,0 +1,166 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60=
|
||||
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200624174652-8d2f3be8b2d9/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-redis/redis/v8 v8.0.0-beta.7/go.mod h1:FGJAWDWFht1sQ4qxyJHZZbVyvnVcKQN0E3u5/5lRz+g=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
|
||||
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/iwind/TeaGo v0.0.0-20200910072805-729cffe36729 h1:/v0WhSFVeNay/dA5zU9iCBXlgVDfxnztuanlauXE0gM=
|
||||
github.com/iwind/TeaGo v0.0.0-20200910072805-729cffe36729/go.mod h1:KU4mS7QNiZ7QWEuDBk1zw0/Q2LrAPZv3tycEFBsuUwc=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
go.opentelemetry.io/otel v0.7.0/go.mod h1:aZMyHG5TqDOXEgH2tyLiXSUKly1jT3yqE9PmrzIeCdo=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0=
|
||||
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
232
pkg/rpc/pb/model_api_node.pb.go
Normal file
232
pkg/rpc/pb/model_api_node.pb.go
Normal file
@@ -0,0 +1,232 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_api_node.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type APINode struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||
ClusterId int64 `protobuf:"varint,3,opt,name=clusterId,proto3" json:"clusterId,omitempty"`
|
||||
UniqueId string `protobuf:"bytes,4,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
|
||||
Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"`
|
||||
Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,7,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Host string `protobuf:"bytes,8,opt,name=host,proto3" json:"host,omitempty"`
|
||||
Port int32 `protobuf:"varint,9,opt,name=port,proto3" json:"port,omitempty"`
|
||||
Address string `protobuf:"bytes,100,opt,name=address,proto3" json:"address,omitempty"`
|
||||
}
|
||||
|
||||
func (x *APINode) Reset() {
|
||||
*x = APINode{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_api_node_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *APINode) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*APINode) ProtoMessage() {}
|
||||
|
||||
func (x *APINode) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_api_node_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use APINode.ProtoReflect.Descriptor instead.
|
||||
func (*APINode) Descriptor() ([]byte, []int) {
|
||||
return file_model_api_node_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *APINode) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *APINode) GetIsOn() bool {
|
||||
if x != nil {
|
||||
return x.IsOn
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *APINode) GetClusterId() int64 {
|
||||
if x != nil {
|
||||
return x.ClusterId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *APINode) GetUniqueId() string {
|
||||
if x != nil {
|
||||
return x.UniqueId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *APINode) GetSecret() string {
|
||||
if x != nil {
|
||||
return x.Secret
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *APINode) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *APINode) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *APINode) GetHost() string {
|
||||
if x != nil {
|
||||
return x.Host
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *APINode) GetPort() int32 {
|
||||
if x != nil {
|
||||
return x.Port
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *APINode) GetAddress() string {
|
||||
if x != nil {
|
||||
return x.Address
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_model_api_node_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_api_node_proto_rawDesc = []byte{
|
||||
0x0a, 0x14, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x6e, 0x6f, 0x64, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xf7, 0x01, 0x0a, 0x07, 0x41,
|
||||
0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c,
|
||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x69, 0x71,
|
||||
0x75, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x71,
|
||||
0x75, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x09,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_api_node_proto_rawDescOnce sync.Once
|
||||
file_model_api_node_proto_rawDescData = file_model_api_node_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_api_node_proto_rawDescGZIP() []byte {
|
||||
file_model_api_node_proto_rawDescOnce.Do(func() {
|
||||
file_model_api_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_api_node_proto_rawDescData)
|
||||
})
|
||||
return file_model_api_node_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_api_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_api_node_proto_goTypes = []interface{}{
|
||||
(*APINode)(nil), // 0: pb.APINode
|
||||
}
|
||||
var file_model_api_node_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_api_node_proto_init() }
|
||||
func file_model_api_node_proto_init() {
|
||||
if File_model_api_node_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_api_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*APINode); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_api_node_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_api_node_proto_goTypes,
|
||||
DependencyIndexes: file_model_api_node_proto_depIdxs,
|
||||
MessageInfos: file_model_api_node_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_api_node_proto = out.File
|
||||
file_model_api_node_proto_rawDesc = nil
|
||||
file_model_api_node_proto_goTypes = nil
|
||||
file_model_api_node_proto_depIdxs = nil
|
||||
}
|
||||
167
pkg/rpc/pb/model_network_address.pb.go
Normal file
167
pkg/rpc/pb/model_network_address.pb.go
Normal file
@@ -0,0 +1,167 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_network_address.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NetworkAddress struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Protocol string `protobuf:"bytes,1,opt,name=protocol,proto3" json:"protocol,omitempty"`
|
||||
Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"`
|
||||
PortRange string `protobuf:"bytes,3,opt,name=portRange,proto3" json:"portRange,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NetworkAddress) Reset() {
|
||||
*x = NetworkAddress{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_network_address_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NetworkAddress) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NetworkAddress) ProtoMessage() {}
|
||||
|
||||
func (x *NetworkAddress) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_network_address_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NetworkAddress.ProtoReflect.Descriptor instead.
|
||||
func (*NetworkAddress) Descriptor() ([]byte, []int) {
|
||||
return file_model_network_address_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NetworkAddress) GetProtocol() string {
|
||||
if x != nil {
|
||||
return x.Protocol
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NetworkAddress) GetHost() string {
|
||||
if x != nil {
|
||||
return x.Host
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NetworkAddress) GetPortRange() string {
|
||||
if x != nil {
|
||||
return x.PortRange
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_model_network_address_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_network_address_proto_rawDesc = []byte{
|
||||
0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70,
|
||||
0x62, 0x22, 0x5e, 0x0a, 0x0e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68,
|
||||
0x6f, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_network_address_proto_rawDescOnce sync.Once
|
||||
file_model_network_address_proto_rawDescData = file_model_network_address_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_network_address_proto_rawDescGZIP() []byte {
|
||||
file_model_network_address_proto_rawDescOnce.Do(func() {
|
||||
file_model_network_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_network_address_proto_rawDescData)
|
||||
})
|
||||
return file_model_network_address_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_network_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_network_address_proto_goTypes = []interface{}{
|
||||
(*NetworkAddress)(nil), // 0: pb.NetworkAddress
|
||||
}
|
||||
var file_model_network_address_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_network_address_proto_init() }
|
||||
func file_model_network_address_proto_init() {
|
||||
if File_model_network_address_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_network_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NetworkAddress); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_network_address_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_network_address_proto_goTypes,
|
||||
DependencyIndexes: file_model_network_address_proto_depIdxs,
|
||||
MessageInfos: file_model_network_address_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_network_address_proto = out.File
|
||||
file_model_network_address_proto_rawDesc = nil
|
||||
file_model_network_address_proto_goTypes = nil
|
||||
file_model_network_address_proto_depIdxs = nil
|
||||
}
|
||||
260
pkg/rpc/pb/model_node.pb.go
Normal file
260
pkg/rpc/pb/model_node.pb.go
Normal file
@@ -0,0 +1,260 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_node.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type Node struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
|
||||
InstallDir string `protobuf:"bytes,4,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
||||
IsInstalled bool `protobuf:"varint,5,opt,name=isInstalled,proto3" json:"isInstalled,omitempty"`
|
||||
Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"`
|
||||
UniqueId string `protobuf:"bytes,7,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
|
||||
Secret string `protobuf:"bytes,8,opt,name=secret,proto3" json:"secret,omitempty"`
|
||||
Cluster *NodeCluster `protobuf:"bytes,32,opt,name=cluster,proto3" json:"cluster,omitempty"`
|
||||
Login *NodeLogin `protobuf:"bytes,33,opt,name=login,proto3" json:"login,omitempty"`
|
||||
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Node) Reset() {
|
||||
*x = Node{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_node_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Node) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Node) ProtoMessage() {}
|
||||
|
||||
func (x *Node) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_node_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Node.ProtoReflect.Descriptor instead.
|
||||
func (*Node) Descriptor() ([]byte, []int) {
|
||||
return file_model_node_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Node) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Node) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetInstallDir() string {
|
||||
if x != nil {
|
||||
return x.InstallDir
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetIsInstalled() bool {
|
||||
if x != nil {
|
||||
return x.IsInstalled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Node) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetUniqueId() string {
|
||||
if x != nil {
|
||||
return x.UniqueId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetSecret() string {
|
||||
if x != nil {
|
||||
return x.Secret
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetCluster() *NodeCluster {
|
||||
if x != nil {
|
||||
return x.Cluster
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Node) GetLogin() *NodeLogin {
|
||||
if x != nil {
|
||||
return x.Login
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Node) GetInstallStatus() *NodeInstallStatus {
|
||||
if x != nil {
|
||||
return x.InstallStatus
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_node_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_node_proto_rawDesc = []byte{
|
||||
0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f,
|
||||
0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x1a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x02, 0x0a, 0x04, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
|
||||
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x20,
|
||||
0x0a, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73,
|
||||
0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73,
|
||||
0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69,
|
||||
0x6e, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74,
|
||||
0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_node_proto_rawDescOnce sync.Once
|
||||
file_model_node_proto_rawDescData = file_model_node_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_node_proto_rawDescGZIP() []byte {
|
||||
file_model_node_proto_rawDescOnce.Do(func() {
|
||||
file_model_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_proto_rawDescData)
|
||||
})
|
||||
return file_model_node_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_node_proto_goTypes = []interface{}{
|
||||
(*Node)(nil), // 0: pb.Node
|
||||
(*NodeCluster)(nil), // 1: pb.NodeCluster
|
||||
(*NodeLogin)(nil), // 2: pb.NodeLogin
|
||||
(*NodeInstallStatus)(nil), // 3: pb.NodeInstallStatus
|
||||
}
|
||||
var file_model_node_proto_depIdxs = []int32{
|
||||
1, // 0: pb.Node.cluster:type_name -> pb.NodeCluster
|
||||
2, // 1: pb.Node.login:type_name -> pb.NodeLogin
|
||||
3, // 2: pb.Node.installStatus:type_name -> pb.NodeInstallStatus
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_node_proto_init() }
|
||||
func file_model_node_proto_init() {
|
||||
if File_model_node_proto != nil {
|
||||
return
|
||||
}
|
||||
file_model_node_cluster_proto_init()
|
||||
file_model_node_login_proto_init()
|
||||
file_model_node_install_status_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Node); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_node_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_node_proto_goTypes,
|
||||
DependencyIndexes: file_model_node_proto_depIdxs,
|
||||
MessageInfos: file_model_node_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_node_proto = out.File
|
||||
file_model_node_proto_rawDesc = nil
|
||||
file_model_node_proto_goTypes = nil
|
||||
file_model_node_proto_depIdxs = nil
|
||||
}
|
||||
185
pkg/rpc/pb/model_node_cluster.pb.go
Normal file
185
pkg/rpc/pb/model_node_cluster.pb.go
Normal file
@@ -0,0 +1,185 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_node_cluster.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NodeCluster struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||
GrantId int64 `protobuf:"varint,4,opt,name=grantId,proto3" json:"grantId,omitempty"`
|
||||
InstallDir string `protobuf:"bytes,5,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeCluster) Reset() {
|
||||
*x = NodeCluster{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_node_cluster_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeCluster) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeCluster) ProtoMessage() {}
|
||||
|
||||
func (x *NodeCluster) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_node_cluster_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeCluster.ProtoReflect.Descriptor instead.
|
||||
func (*NodeCluster) Descriptor() ([]byte, []int) {
|
||||
return file_model_node_cluster_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeCluster) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeCluster) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeCluster) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeCluster) GetGrantId() int64 {
|
||||
if x != nil {
|
||||
return x.GrantId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeCluster) GetInstallDir() string {
|
||||
if x != nil {
|
||||
return x.InstallDir
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_model_node_cluster_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_node_cluster_proto_rawDesc = []byte{
|
||||
0x0a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x89,
|
||||
0x01, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e,
|
||||
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
|
||||
0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_node_cluster_proto_rawDescOnce sync.Once
|
||||
file_model_node_cluster_proto_rawDescData = file_model_node_cluster_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_node_cluster_proto_rawDescGZIP() []byte {
|
||||
file_model_node_cluster_proto_rawDescOnce.Do(func() {
|
||||
file_model_node_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_cluster_proto_rawDescData)
|
||||
})
|
||||
return file_model_node_cluster_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_node_cluster_proto_goTypes = []interface{}{
|
||||
(*NodeCluster)(nil), // 0: pb.NodeCluster
|
||||
}
|
||||
var file_model_node_cluster_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_node_cluster_proto_init() }
|
||||
func file_model_node_cluster_proto_init() {
|
||||
if File_model_node_cluster_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_node_cluster_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeCluster); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_node_cluster_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_node_cluster_proto_goTypes,
|
||||
DependencyIndexes: file_model_node_cluster_proto_depIdxs,
|
||||
MessageInfos: file_model_node_cluster_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_node_cluster_proto = out.File
|
||||
file_model_node_cluster_proto_rawDesc = nil
|
||||
file_model_node_cluster_proto_goTypes = nil
|
||||
file_model_node_cluster_proto_depIdxs = nil
|
||||
}
|
||||
223
pkg/rpc/pb/model_node_grant.pb.go
Normal file
223
pkg/rpc/pb/model_node_grant.pb.go
Normal file
@@ -0,0 +1,223 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_node_grant.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NodeGrant struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
|
||||
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`
|
||||
Su bool `protobuf:"varint,6,opt,name=su,proto3" json:"su,omitempty"`
|
||||
PrivateKey string `protobuf:"bytes,7,opt,name=privateKey,proto3" json:"privateKey,omitempty"`
|
||||
Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"`
|
||||
NodeId int64 `protobuf:"varint,9,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeGrant) Reset() {
|
||||
*x = NodeGrant{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_node_grant_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeGrant) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeGrant) ProtoMessage() {}
|
||||
|
||||
func (x *NodeGrant) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_node_grant_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeGrant.ProtoReflect.Descriptor instead.
|
||||
func (*NodeGrant) Descriptor() ([]byte, []int) {
|
||||
return file_model_node_grant_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetMethod() string {
|
||||
if x != nil {
|
||||
return x.Method
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetSu() bool {
|
||||
if x != nil {
|
||||
return x.Su
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetPrivateKey() string {
|
||||
if x != nil {
|
||||
return x.PrivateKey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeGrant) GetNodeId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_model_node_grant_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_node_grant_proto_rawDesc = []byte{
|
||||
0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x72, 0x61,
|
||||
0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xe9, 0x01, 0x0a,
|
||||
0x09, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x73, 0x75, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x73, 0x75, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20,
|
||||
0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_node_grant_proto_rawDescOnce sync.Once
|
||||
file_model_node_grant_proto_rawDescData = file_model_node_grant_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_node_grant_proto_rawDescGZIP() []byte {
|
||||
file_model_node_grant_proto_rawDescOnce.Do(func() {
|
||||
file_model_node_grant_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_grant_proto_rawDescData)
|
||||
})
|
||||
return file_model_node_grant_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_node_grant_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_node_grant_proto_goTypes = []interface{}{
|
||||
(*NodeGrant)(nil), // 0: pb.NodeGrant
|
||||
}
|
||||
var file_model_node_grant_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_node_grant_proto_init() }
|
||||
func file_model_node_grant_proto_init() {
|
||||
if File_model_node_grant_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_node_grant_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeGrant); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_node_grant_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_node_grant_proto_goTypes,
|
||||
DependencyIndexes: file_model_node_grant_proto_depIdxs,
|
||||
MessageInfos: file_model_node_grant_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_node_grant_proto = out.File
|
||||
file_model_node_grant_proto_rawDesc = nil
|
||||
file_model_node_grant_proto_goTypes = nil
|
||||
file_model_node_grant_proto_depIdxs = nil
|
||||
}
|
||||
187
pkg/rpc/pb/model_node_install_status.pb.go
Normal file
187
pkg/rpc/pb/model_node_install_status.pb.go
Normal file
@@ -0,0 +1,187 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_node_install_status.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NodeInstallStatus struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsRunning bool `protobuf:"varint,1,opt,name=isRunning,proto3" json:"isRunning,omitempty"`
|
||||
IsFinished bool `protobuf:"varint,2,opt,name=isFinished,proto3" json:"isFinished,omitempty"`
|
||||
IsOk bool `protobuf:"varint,3,opt,name=isOk,proto3" json:"isOk,omitempty"`
|
||||
Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
|
||||
UpdatedAt int64 `protobuf:"varint,5,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) Reset() {
|
||||
*x = NodeInstallStatus{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_node_install_status_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeInstallStatus) ProtoMessage() {}
|
||||
|
||||
func (x *NodeInstallStatus) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_node_install_status_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeInstallStatus.ProtoReflect.Descriptor instead.
|
||||
func (*NodeInstallStatus) Descriptor() ([]byte, []int) {
|
||||
return file_model_node_install_status_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) GetIsRunning() bool {
|
||||
if x != nil {
|
||||
return x.IsRunning
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) GetIsFinished() bool {
|
||||
if x != nil {
|
||||
return x.IsFinished
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) GetIsOk() bool {
|
||||
if x != nil {
|
||||
return x.IsOk
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) GetError() string {
|
||||
if x != nil {
|
||||
return x.Error
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeInstallStatus) GetUpdatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_model_node_install_status_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_node_install_status_proto_rawDesc = []byte{
|
||||
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x73,
|
||||
0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x99, 0x01, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e,
|
||||
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69,
|
||||
0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
|
||||
0x69, 0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x46,
|
||||
0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69,
|
||||
0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f,
|
||||
0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72,
|
||||
0x72, 0x6f, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41,
|
||||
0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_node_install_status_proto_rawDescOnce sync.Once
|
||||
file_model_node_install_status_proto_rawDescData = file_model_node_install_status_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_node_install_status_proto_rawDescGZIP() []byte {
|
||||
file_model_node_install_status_proto_rawDescOnce.Do(func() {
|
||||
file_model_node_install_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_install_status_proto_rawDescData)
|
||||
})
|
||||
return file_model_node_install_status_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_node_install_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_node_install_status_proto_goTypes = []interface{}{
|
||||
(*NodeInstallStatus)(nil), // 0: pb.NodeInstallStatus
|
||||
}
|
||||
var file_model_node_install_status_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_node_install_status_proto_init() }
|
||||
func file_model_node_install_status_proto_init() {
|
||||
if File_model_node_install_status_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_node_install_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeInstallStatus); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_node_install_status_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_node_install_status_proto_goTypes,
|
||||
DependencyIndexes: file_model_node_install_status_proto_depIdxs,
|
||||
MessageInfos: file_model_node_install_status_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_node_install_status_proto = out.File
|
||||
file_model_node_install_status_proto_rawDesc = nil
|
||||
file_model_node_install_status_proto_goTypes = nil
|
||||
file_model_node_install_status_proto_depIdxs = nil
|
||||
}
|
||||
203
pkg/rpc/pb/model_node_ip_address.pb.go
Normal file
203
pkg/rpc/pb/model_node_ip_address.pb.go
Normal file
@@ -0,0 +1,203 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_node_ip_address.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NodeIPAddress struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
NodeId int64 `protobuf:"varint,2,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
|
||||
State int64 `protobuf:"varint,6,opt,name=state,proto3" json:"state,omitempty"`
|
||||
Order int64 `protobuf:"varint,7,opt,name=order,proto3" json:"order,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) Reset() {
|
||||
*x = NodeIPAddress{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_node_ip_address_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeIPAddress) ProtoMessage() {}
|
||||
|
||||
func (x *NodeIPAddress) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_node_ip_address_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeIPAddress.ProtoReflect.Descriptor instead.
|
||||
func (*NodeIPAddress) Descriptor() ([]byte, []int) {
|
||||
return file_model_node_ip_address_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetNodeId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetState() int64 {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeIPAddress) GetOrder() int64 {
|
||||
if x != nil {
|
||||
return x.Order
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_model_node_ip_address_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_node_ip_address_proto_rawDesc = []byte{
|
||||
0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70,
|
||||
0x62, 0x22, 0xa9, 0x01, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12,
|
||||
0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_node_ip_address_proto_rawDescOnce sync.Once
|
||||
file_model_node_ip_address_proto_rawDescData = file_model_node_ip_address_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_node_ip_address_proto_rawDescGZIP() []byte {
|
||||
file_model_node_ip_address_proto_rawDescOnce.Do(func() {
|
||||
file_model_node_ip_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_ip_address_proto_rawDescData)
|
||||
})
|
||||
return file_model_node_ip_address_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_node_ip_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_node_ip_address_proto_goTypes = []interface{}{
|
||||
(*NodeIPAddress)(nil), // 0: pb.NodeIPAddress
|
||||
}
|
||||
var file_model_node_ip_address_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_node_ip_address_proto_init() }
|
||||
func file_model_node_ip_address_proto_init() {
|
||||
if File_model_node_ip_address_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_node_ip_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeIPAddress); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_node_ip_address_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_node_ip_address_proto_goTypes,
|
||||
DependencyIndexes: file_model_node_ip_address_proto_depIdxs,
|
||||
MessageInfos: file_model_node_ip_address_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_node_ip_address_proto = out.File
|
||||
file_model_node_ip_address_proto_rawDesc = nil
|
||||
file_model_node_ip_address_proto_goTypes = nil
|
||||
file_model_node_ip_address_proto_depIdxs = nil
|
||||
}
|
||||
174
pkg/rpc/pb/model_node_login.pb.go
Normal file
174
pkg/rpc/pb/model_node_login.pb.go
Normal file
@@ -0,0 +1,174 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_node_login.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type NodeLogin struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Params []byte `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeLogin) Reset() {
|
||||
*x = NodeLogin{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_node_login_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeLogin) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeLogin) ProtoMessage() {}
|
||||
|
||||
func (x *NodeLogin) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_node_login_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeLogin.ProtoReflect.Descriptor instead.
|
||||
func (*NodeLogin) Descriptor() ([]byte, []int) {
|
||||
return file_model_node_login_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NodeLogin) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NodeLogin) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeLogin) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeLogin) GetParams() []byte {
|
||||
if x != nil {
|
||||
return x.Params
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_node_login_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_node_login_proto_rawDesc = []byte{
|
||||
0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x5b, 0x0a, 0x09,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x0c, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_node_login_proto_rawDescOnce sync.Once
|
||||
file_model_node_login_proto_rawDescData = file_model_node_login_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_node_login_proto_rawDescGZIP() []byte {
|
||||
file_model_node_login_proto_rawDescOnce.Do(func() {
|
||||
file_model_node_login_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_login_proto_rawDescData)
|
||||
})
|
||||
return file_model_node_login_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_node_login_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_node_login_proto_goTypes = []interface{}{
|
||||
(*NodeLogin)(nil), // 0: pb.NodeLogin
|
||||
}
|
||||
var file_model_node_login_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_node_login_proto_init() }
|
||||
func file_model_node_login_proto_init() {
|
||||
if File_model_node_login_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_node_login_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeLogin); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_node_login_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_node_login_proto_goTypes,
|
||||
DependencyIndexes: file_model_node_login_proto_depIdxs,
|
||||
MessageInfos: file_model_node_login_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_node_login_proto = out.File
|
||||
file_model_node_login_proto_rawDesc = nil
|
||||
file_model_node_login_proto_goTypes = nil
|
||||
file_model_node_login_proto_depIdxs = nil
|
||||
}
|
||||
190
pkg/rpc/pb/model_origin_server.pb.go
Normal file
190
pkg/rpc/pb/model_origin_server.pb.go
Normal file
@@ -0,0 +1,190 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_origin_server.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type OriginServer struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Addr *NetworkAddress `protobuf:"bytes,4,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (x *OriginServer) Reset() {
|
||||
*x = OriginServer{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_origin_server_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *OriginServer) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*OriginServer) ProtoMessage() {}
|
||||
|
||||
func (x *OriginServer) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_origin_server_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use OriginServer.ProtoReflect.Descriptor instead.
|
||||
func (*OriginServer) Descriptor() ([]byte, []int) {
|
||||
return file_model_origin_server_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *OriginServer) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *OriginServer) GetIsOn() bool {
|
||||
if x != nil {
|
||||
return x.IsOn
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *OriginServer) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *OriginServer) GetAddr() *NetworkAddress {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *OriginServer) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_model_origin_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_origin_server_proto_rawDesc = []byte{
|
||||
0x0a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a,
|
||||
0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a,
|
||||
0x0c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f,
|
||||
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
|
||||
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a,
|
||||
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_origin_server_proto_rawDescOnce sync.Once
|
||||
file_model_origin_server_proto_rawDescData = file_model_origin_server_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_origin_server_proto_rawDescGZIP() []byte {
|
||||
file_model_origin_server_proto_rawDescOnce.Do(func() {
|
||||
file_model_origin_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_origin_server_proto_rawDescData)
|
||||
})
|
||||
return file_model_origin_server_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_origin_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_origin_server_proto_goTypes = []interface{}{
|
||||
(*OriginServer)(nil), // 0: pb.OriginServer
|
||||
(*NetworkAddress)(nil), // 1: pb.NetworkAddress
|
||||
}
|
||||
var file_model_origin_server_proto_depIdxs = []int32{
|
||||
1, // 0: pb.OriginServer.addr:type_name -> pb.NetworkAddress
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_origin_server_proto_init() }
|
||||
func file_model_origin_server_proto_init() {
|
||||
if File_model_origin_server_proto != nil {
|
||||
return
|
||||
}
|
||||
file_model_network_address_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_origin_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*OriginServer); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_origin_server_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_origin_server_proto_goTypes,
|
||||
DependencyIndexes: file_model_origin_server_proto_depIdxs,
|
||||
MessageInfos: file_model_origin_server_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_origin_server_proto = out.File
|
||||
file_model_origin_server_proto_rawDesc = nil
|
||||
file_model_origin_server_proto_goTypes = nil
|
||||
file_model_origin_server_proto_depIdxs = nil
|
||||
}
|
||||
229
pkg/rpc/pb/model_server.pb.go
Normal file
229
pkg/rpc/pb/model_server.pb.go
Normal file
@@ -0,0 +1,229 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: model_server.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type Server struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Config []byte `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
|
||||
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
|
||||
IncludeNodes []byte `protobuf:"bytes,6,opt,name=includeNodes,proto3" json:"includeNodes,omitempty"`
|
||||
ExcludeNodes []byte `protobuf:"bytes,7,opt,name=excludeNodes,proto3" json:"excludeNodes,omitempty"`
|
||||
CreatedAt int64 `protobuf:"varint,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||
Cluster *NodeCluster `protobuf:"bytes,10,opt,name=cluster,proto3" json:"cluster,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Server) Reset() {
|
||||
*x = Server{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_model_server_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server) ProtoMessage() {}
|
||||
|
||||
func (x *Server) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_model_server_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Server.ProtoReflect.Descriptor instead.
|
||||
func (*Server) Descriptor() ([]byte, []int) {
|
||||
return file_model_server_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Server) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Server) GetConfig() []byte {
|
||||
if x != nil {
|
||||
return x.Config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server) GetIncludeNodes() []byte {
|
||||
if x != nil {
|
||||
return x.IncludeNodes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetExcludeNodes() []byte {
|
||||
if x != nil {
|
||||
return x.ExcludeNodes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Server) GetCluster() *NodeCluster {
|
||||
if x != nil {
|
||||
return x.Cluster
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_server_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x22, 0x8b, 0x02, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
|
||||
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75,
|
||||
0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x64, 0x41, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_model_server_proto_rawDescOnce sync.Once
|
||||
file_model_server_proto_rawDescData = file_model_server_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_model_server_proto_rawDescGZIP() []byte {
|
||||
file_model_server_proto_rawDescOnce.Do(func() {
|
||||
file_model_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_server_proto_rawDescData)
|
||||
})
|
||||
return file_model_server_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_model_server_proto_goTypes = []interface{}{
|
||||
(*Server)(nil), // 0: pb.Server
|
||||
(*NodeCluster)(nil), // 1: pb.NodeCluster
|
||||
}
|
||||
var file_model_server_proto_depIdxs = []int32{
|
||||
1, // 0: pb.Server.cluster:type_name -> pb.NodeCluster
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_server_proto_init() }
|
||||
func file_model_server_proto_init() {
|
||||
if File_model_server_proto != nil {
|
||||
return
|
||||
}
|
||||
file_model_node_cluster_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_model_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_server_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_server_proto_goTypes,
|
||||
DependencyIndexes: file_model_server_proto_depIdxs,
|
||||
MessageInfos: file_model_server_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_server_proto = out.File
|
||||
file_model_server_proto_rawDesc = nil
|
||||
file_model_server_proto_goTypes = nil
|
||||
file_model_server_proto_depIdxs = nil
|
||||
}
|
||||
884
pkg/rpc/pb/service_admin.pb.go
Normal file
884
pkg/rpc/pb/service_admin.pb.go
Normal file
@@ -0,0 +1,884 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_admin.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type LoginAdminRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
||||
}
|
||||
|
||||
func (x *LoginAdminRequest) Reset() {
|
||||
*x = LoginAdminRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *LoginAdminRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LoginAdminRequest) ProtoMessage() {}
|
||||
|
||||
func (x *LoginAdminRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LoginAdminRequest.ProtoReflect.Descriptor instead.
|
||||
func (*LoginAdminRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *LoginAdminRequest) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *LoginAdminRequest) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type LoginAdminResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
|
||||
IsOk bool `protobuf:"varint,2,opt,name=isOk,proto3" json:"isOk,omitempty"`
|
||||
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *LoginAdminResponse) Reset() {
|
||||
*x = LoginAdminResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *LoginAdminResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LoginAdminResponse) ProtoMessage() {}
|
||||
|
||||
func (x *LoginAdminResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LoginAdminResponse.ProtoReflect.Descriptor instead.
|
||||
func (*LoginAdminResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *LoginAdminResponse) GetAdminId() int64 {
|
||||
if x != nil {
|
||||
return x.AdminId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *LoginAdminResponse) GetIsOk() bool {
|
||||
if x != nil {
|
||||
return x.IsOk
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *LoginAdminResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateAdminLogRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogRequest) Reset() {
|
||||
*x = CreateAdminLogRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateAdminLogRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateAdminLogRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateAdminLogRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateAdminLogRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogRequest) GetLevel() string {
|
||||
if x != nil {
|
||||
return x.Level
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogRequest) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogRequest) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogRequest) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateAdminLogResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogResponse) Reset() {
|
||||
*x = CreateAdminLogResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateAdminLogResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateAdminLogResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateAdminLogResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateAdminLogResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *CreateAdminLogResponse) GetIsOk() bool {
|
||||
if x != nil {
|
||||
return x.IsOk
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type CheckAdminExistsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsRequest) Reset() {
|
||||
*x = CheckAdminExistsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CheckAdminExistsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CheckAdminExistsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CheckAdminExistsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CheckAdminExistsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsRequest) GetAdminId() int64 {
|
||||
if x != nil {
|
||||
return x.AdminId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type CheckAdminExistsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsResponse) Reset() {
|
||||
*x = CheckAdminExistsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CheckAdminExistsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CheckAdminExistsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CheckAdminExistsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CheckAdminExistsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsResponse) GetIsOk() bool {
|
||||
if x != nil {
|
||||
return x.IsOk
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CheckAdminExistsResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type FindAdminFullnameRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindAdminFullnameRequest) Reset() {
|
||||
*x = FindAdminFullnameRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindAdminFullnameRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindAdminFullnameRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FindAdminFullnameRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindAdminFullnameRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FindAdminFullnameRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *FindAdminFullnameRequest) GetAdminId() int64 {
|
||||
if x != nil {
|
||||
return x.AdminId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FindAdminFullnameResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Fullname string `protobuf:"bytes,1,opt,name=fullname,proto3" json:"fullname,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindAdminFullnameResponse) Reset() {
|
||||
*x = FindAdminFullnameResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_admin_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindAdminFullnameResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindAdminFullnameResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FindAdminFullnameResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_admin_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindAdminFullnameResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FindAdminFullnameResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_admin_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *FindAdminFullnameResponse) GetFullname() string {
|
||||
if x != nil {
|
||||
return x.Fullname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_service_admin_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_admin_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4b, 0x0a, 0x11, 0x4c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x5c, 0x0a, 0x12, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41,
|
||||
0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61,
|
||||
0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x22, 0x77, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64,
|
||||
0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65,
|
||||
0x76, 0x65, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x2c, 0x0a,
|
||||
0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x22, 0x33, 0x0a, 0x17, 0x43,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64,
|
||||
0x22, 0x48, 0x0a, 0x18, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78,
|
||||
0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x69, 0x73, 0x4f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x34, 0x0a, 0x18, 0x46, 0x69,
|
||||
0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64,
|
||||
0x22, 0x37, 0x0a, 0x19, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c,
|
||||
0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xbd, 0x02, 0x0a, 0x0c, 0x41, 0x64,
|
||||
0x6d, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x6c, 0x6f,
|
||||
0x67, 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f,
|
||||
0x67, 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x16, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0e, 0x63, 0x72, 0x65,
|
||||
0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x12, 0x19, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d,
|
||||
0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68,
|
||||
0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b,
|
||||
0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d,
|
||||
0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69,
|
||||
0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_service_admin_proto_rawDescOnce sync.Once
|
||||
file_service_admin_proto_rawDescData = file_service_admin_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_service_admin_proto_rawDescGZIP() []byte {
|
||||
file_service_admin_proto_rawDescOnce.Do(func() {
|
||||
file_service_admin_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_admin_proto_rawDescData)
|
||||
})
|
||||
return file_service_admin_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_service_admin_proto_goTypes = []interface{}{
|
||||
(*LoginAdminRequest)(nil), // 0: pb.LoginAdminRequest
|
||||
(*LoginAdminResponse)(nil), // 1: pb.LoginAdminResponse
|
||||
(*CreateAdminLogRequest)(nil), // 2: pb.CreateAdminLogRequest
|
||||
(*CreateAdminLogResponse)(nil), // 3: pb.CreateAdminLogResponse
|
||||
(*CheckAdminExistsRequest)(nil), // 4: pb.CheckAdminExistsRequest
|
||||
(*CheckAdminExistsResponse)(nil), // 5: pb.CheckAdminExistsResponse
|
||||
(*FindAdminFullnameRequest)(nil), // 6: pb.FindAdminFullnameRequest
|
||||
(*FindAdminFullnameResponse)(nil), // 7: pb.FindAdminFullnameResponse
|
||||
}
|
||||
var file_service_admin_proto_depIdxs = []int32{
|
||||
0, // 0: pb.AdminService.loginAdmin:input_type -> pb.LoginAdminRequest
|
||||
2, // 1: pb.AdminService.createAdminLog:input_type -> pb.CreateAdminLogRequest
|
||||
4, // 2: pb.AdminService.checkAdminExists:input_type -> pb.CheckAdminExistsRequest
|
||||
6, // 3: pb.AdminService.findAdminFullname:input_type -> pb.FindAdminFullnameRequest
|
||||
1, // 4: pb.AdminService.loginAdmin:output_type -> pb.LoginAdminResponse
|
||||
3, // 5: pb.AdminService.createAdminLog:output_type -> pb.CreateAdminLogResponse
|
||||
5, // 6: pb.AdminService.checkAdminExists:output_type -> pb.CheckAdminExistsResponse
|
||||
7, // 7: pb.AdminService.findAdminFullname:output_type -> pb.FindAdminFullnameResponse
|
||||
4, // [4:8] is the sub-list for method output_type
|
||||
0, // [0:4] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_admin_proto_init() }
|
||||
func file_service_admin_proto_init() {
|
||||
if File_service_admin_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_service_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LoginAdminRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LoginAdminResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateAdminLogRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateAdminLogResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CheckAdminExistsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CheckAdminExistsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindAdminFullnameRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_admin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindAdminFullnameResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_admin_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_service_admin_proto_goTypes,
|
||||
DependencyIndexes: file_service_admin_proto_depIdxs,
|
||||
MessageInfos: file_service_admin_proto_msgTypes,
|
||||
}.Build()
|
||||
File_service_admin_proto = out.File
|
||||
file_service_admin_proto_rawDesc = nil
|
||||
file_service_admin_proto_goTypes = nil
|
||||
file_service_admin_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// AdminServiceClient is the client API for AdminService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type AdminServiceClient interface {
|
||||
// 登录
|
||||
LoginAdmin(ctx context.Context, in *LoginAdminRequest, opts ...grpc.CallOption) (*LoginAdminResponse, error)
|
||||
// 创建操作日志
|
||||
CreateAdminLog(ctx context.Context, in *CreateAdminLogRequest, opts ...grpc.CallOption) (*CreateAdminLogResponse, error)
|
||||
// 检查管理员是否存在
|
||||
CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error)
|
||||
// 获取管理员名称
|
||||
FindAdminFullname(ctx context.Context, in *FindAdminFullnameRequest, opts ...grpc.CallOption) (*FindAdminFullnameResponse, error)
|
||||
}
|
||||
|
||||
type adminServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient {
|
||||
return &adminServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) LoginAdmin(ctx context.Context, in *LoginAdminRequest, opts ...grpc.CallOption) (*LoginAdminResponse, error) {
|
||||
out := new(LoginAdminResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.AdminService/loginAdmin", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) CreateAdminLog(ctx context.Context, in *CreateAdminLogRequest, opts ...grpc.CallOption) (*CreateAdminLogResponse, error) {
|
||||
out := new(CreateAdminLogResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.AdminService/createAdminLog", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error) {
|
||||
out := new(CheckAdminExistsResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.AdminService/checkAdminExists", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) FindAdminFullname(ctx context.Context, in *FindAdminFullnameRequest, opts ...grpc.CallOption) (*FindAdminFullnameResponse, error) {
|
||||
out := new(FindAdminFullnameResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.AdminService/findAdminFullname", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AdminServiceServer is the server API for AdminService service.
|
||||
type AdminServiceServer interface {
|
||||
// 登录
|
||||
LoginAdmin(context.Context, *LoginAdminRequest) (*LoginAdminResponse, error)
|
||||
// 创建操作日志
|
||||
CreateAdminLog(context.Context, *CreateAdminLogRequest) (*CreateAdminLogResponse, error)
|
||||
// 检查管理员是否存在
|
||||
CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error)
|
||||
// 获取管理员名称
|
||||
FindAdminFullname(context.Context, *FindAdminFullnameRequest) (*FindAdminFullnameResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedAdminServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedAdminServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedAdminServiceServer) LoginAdmin(context.Context, *LoginAdminRequest) (*LoginAdminResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method LoginAdmin not implemented")
|
||||
}
|
||||
func (*UnimplementedAdminServiceServer) CreateAdminLog(context.Context, *CreateAdminLogRequest) (*CreateAdminLogResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateAdminLog not implemented")
|
||||
}
|
||||
func (*UnimplementedAdminServiceServer) CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CheckAdminExists not implemented")
|
||||
}
|
||||
func (*UnimplementedAdminServiceServer) FindAdminFullname(context.Context, *FindAdminFullnameRequest) (*FindAdminFullnameResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindAdminFullname not implemented")
|
||||
}
|
||||
|
||||
func RegisterAdminServiceServer(s *grpc.Server, srv AdminServiceServer) {
|
||||
s.RegisterService(&_AdminService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _AdminService_LoginAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LoginAdminRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).LoginAdmin(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.AdminService/LoginAdmin",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).LoginAdmin(ctx, req.(*LoginAdminRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AdminService_CreateAdminLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateAdminLogRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).CreateAdminLog(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.AdminService/CreateAdminLog",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).CreateAdminLog(ctx, req.(*CreateAdminLogRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AdminService_CheckAdminExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CheckAdminExistsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).CheckAdminExists(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.AdminService/CheckAdminExists",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).CheckAdminExists(ctx, req.(*CheckAdminExistsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AdminService_FindAdminFullname_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FindAdminFullnameRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).FindAdminFullname(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.AdminService/FindAdminFullname",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).FindAdminFullname(ctx, req.(*FindAdminFullnameRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _AdminService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.AdminService",
|
||||
HandlerType: (*AdminServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "loginAdmin",
|
||||
Handler: _AdminService_LoginAdmin_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "createAdminLog",
|
||||
Handler: _AdminService_CreateAdminLog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "checkAdminExists",
|
||||
Handler: _AdminService_CheckAdminExists_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "findAdminFullname",
|
||||
Handler: _AdminService_FindAdminFullname_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_admin.proto",
|
||||
}
|
||||
1385
pkg/rpc/pb/service_api_node.pb.go
Normal file
1385
pkg/rpc/pb/service_api_node.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
66
pkg/rpc/pb/service_log.pb.go
Normal file
66
pkg/rpc/pb/service_log.pb.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_log.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
var File_service_log_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_log_proto_rawDesc = []byte{
|
||||
0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_service_log_proto_goTypes = []interface{}{}
|
||||
var file_service_log_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_log_proto_init() }
|
||||
func file_service_log_proto_init() {
|
||||
if File_service_log_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_log_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_service_log_proto_goTypes,
|
||||
DependencyIndexes: file_service_log_proto_depIdxs,
|
||||
}.Build()
|
||||
File_service_log_proto = out.File
|
||||
file_service_log_proto_rawDesc = nil
|
||||
file_service_log_proto_goTypes = nil
|
||||
file_service_log_proto_depIdxs = nil
|
||||
}
|
||||
2426
pkg/rpc/pb/service_node.pb.go
Normal file
2426
pkg/rpc/pb/service_node.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
1547
pkg/rpc/pb/service_node_cluster.pb.go
Normal file
1547
pkg/rpc/pb/service_node_cluster.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
1450
pkg/rpc/pb/service_node_grant.pb.go
Normal file
1450
pkg/rpc/pb/service_node_grant.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
66
pkg/rpc/pb/service_node_group.pb.go
Normal file
66
pkg/rpc/pb/service_node_group.pb.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_node_group.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
var File_service_node_group_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_node_group_proto_rawDesc = []byte{
|
||||
0x0a, 0x18, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67,
|
||||
0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_service_node_group_proto_goTypes = []interface{}{}
|
||||
var file_service_node_group_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_node_group_proto_init() }
|
||||
func file_service_node_group_proto_init() {
|
||||
if File_service_node_group_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_node_group_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_service_node_group_proto_goTypes,
|
||||
DependencyIndexes: file_service_node_group_proto_depIdxs,
|
||||
}.Build()
|
||||
File_service_node_group_proto = out.File
|
||||
file_service_node_group_proto_rawDesc = nil
|
||||
file_service_node_group_proto_goTypes = nil
|
||||
file_service_node_group_proto_depIdxs = nil
|
||||
}
|
||||
1375
pkg/rpc/pb/service_node_ip_address.pb.go
Normal file
1375
pkg/rpc/pb/service_node_ip_address.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
66
pkg/rpc/pb/service_node_region.pb.go
Normal file
66
pkg/rpc/pb/service_node_region.pb.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_node_region.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
var File_service_node_region_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_node_region_proto_rawDesc = []byte{
|
||||
0x0a, 0x19, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x72,
|
||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_service_node_region_proto_goTypes = []interface{}{}
|
||||
var file_service_node_region_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_node_region_proto_init() }
|
||||
func file_service_node_region_proto_init() {
|
||||
if File_service_node_region_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_node_region_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_service_node_region_proto_goTypes,
|
||||
DependencyIndexes: file_service_node_region_proto_depIdxs,
|
||||
}.Build()
|
||||
File_service_node_region_proto = out.File
|
||||
file_service_node_region_proto_rawDesc = nil
|
||||
file_service_node_region_proto_goTypes = nil
|
||||
file_service_node_region_proto_depIdxs = nil
|
||||
}
|
||||
707
pkg/rpc/pb/service_origin_server.pb.go
Normal file
707
pkg/rpc/pb/service_origin_server.pb.go
Normal file
@@ -0,0 +1,707 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_origin_server.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
// 创建源站
|
||||
type CreateOriginServerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Addr *NetworkAddress `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerRequest) Reset() {
|
||||
*x = CreateOriginServerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_origin_server_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateOriginServerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateOriginServerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_origin_server_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateOriginServerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateOriginServerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_origin_server_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerRequest) GetAddr() *NetworkAddress {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerRequest) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateOriginServerResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerResponse) Reset() {
|
||||
*x = CreateOriginServerResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_origin_server_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateOriginServerResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateOriginServerResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_origin_server_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateOriginServerResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateOriginServerResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_origin_server_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateOriginServerResponse) GetOriginId() int64 {
|
||||
if x != nil {
|
||||
return x.OriginId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 修改源站
|
||||
type UpdateOriginServerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Addr *NetworkAddress `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
|
||||
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerRequest) Reset() {
|
||||
*x = UpdateOriginServerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_origin_server_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateOriginServerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateOriginServerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_origin_server_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateOriginServerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateOriginServerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_origin_server_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerRequest) GetOriginId() int64 {
|
||||
if x != nil {
|
||||
return x.OriginId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerRequest) GetAddr() *NetworkAddress {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerRequest) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UpdateOriginServerResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerResponse) Reset() {
|
||||
*x = UpdateOriginServerResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_origin_server_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateOriginServerResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateOriginServerResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateOriginServerResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_origin_server_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateOriginServerResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateOriginServerResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_origin_server_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
// 查找单个源站信息
|
||||
type FindEnabledOriginServerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginServerRequest) Reset() {
|
||||
*x = FindEnabledOriginServerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_origin_server_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginServerRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindEnabledOriginServerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FindEnabledOriginServerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_origin_server_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindEnabledOriginServerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FindEnabledOriginServerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_origin_server_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginServerRequest) GetOriginId() int64 {
|
||||
if x != nil {
|
||||
return x.OriginId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FindEnabledOriginServerResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Origin *OriginServer `protobuf:"bytes,1,opt,name=Origin,proto3" json:"Origin,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginServerResponse) Reset() {
|
||||
*x = FindEnabledOriginServerResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_origin_server_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginServerResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindEnabledOriginServerResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FindEnabledOriginServerResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_origin_server_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindEnabledOriginServerResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FindEnabledOriginServerResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_origin_server_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginServerResponse) GetOrigin() *OriginServer {
|
||||
if x != nil {
|
||||
return x.Origin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_service_origin_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_origin_server_proto_rawDesc = []byte{
|
||||
0x0a, 0x1b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
||||
0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70,
|
||||
0x62, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x6d, 0x6f,
|
||||
0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x79, 0x0a, 0x19, 0x43, 0x72, 0x65,
|
||||
0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x61, 0x64,
|
||||
0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65,
|
||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x64,
|
||||
0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72,
|
||||
0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x95,
|
||||
0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
|
||||
0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x1c, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x0a, 0x1e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
||||
0x49, 0x64, 0x22, 0x4b, 0x0a, 0x1f, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69,
|
||||
0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x32,
|
||||
0xa3, 0x02, 0x0a, 0x13, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x1d, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70,
|
||||
0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12,
|
||||
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72,
|
||||
0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69,
|
||||
0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x62, 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
|
||||
0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x70,
|
||||
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69,
|
||||
0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_service_origin_server_proto_rawDescOnce sync.Once
|
||||
file_service_origin_server_proto_rawDescData = file_service_origin_server_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_service_origin_server_proto_rawDescGZIP() []byte {
|
||||
file_service_origin_server_proto_rawDescOnce.Do(func() {
|
||||
file_service_origin_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_origin_server_proto_rawDescData)
|
||||
})
|
||||
return file_service_origin_server_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_origin_server_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_service_origin_server_proto_goTypes = []interface{}{
|
||||
(*CreateOriginServerRequest)(nil), // 0: pb.CreateOriginServerRequest
|
||||
(*CreateOriginServerResponse)(nil), // 1: pb.CreateOriginServerResponse
|
||||
(*UpdateOriginServerRequest)(nil), // 2: pb.UpdateOriginServerRequest
|
||||
(*UpdateOriginServerResponse)(nil), // 3: pb.UpdateOriginServerResponse
|
||||
(*FindEnabledOriginServerRequest)(nil), // 4: pb.FindEnabledOriginServerRequest
|
||||
(*FindEnabledOriginServerResponse)(nil), // 5: pb.FindEnabledOriginServerResponse
|
||||
(*NetworkAddress)(nil), // 6: pb.NetworkAddress
|
||||
(*OriginServer)(nil), // 7: pb.OriginServer
|
||||
}
|
||||
var file_service_origin_server_proto_depIdxs = []int32{
|
||||
6, // 0: pb.CreateOriginServerRequest.addr:type_name -> pb.NetworkAddress
|
||||
6, // 1: pb.UpdateOriginServerRequest.addr:type_name -> pb.NetworkAddress
|
||||
7, // 2: pb.FindEnabledOriginServerResponse.Origin:type_name -> pb.OriginServer
|
||||
0, // 3: pb.OriginServerService.createOriginServer:input_type -> pb.CreateOriginServerRequest
|
||||
2, // 4: pb.OriginServerService.updateOriginServer:input_type -> pb.UpdateOriginServerRequest
|
||||
4, // 5: pb.OriginServerService.findEnabledOriginServer:input_type -> pb.FindEnabledOriginServerRequest
|
||||
1, // 6: pb.OriginServerService.createOriginServer:output_type -> pb.CreateOriginServerResponse
|
||||
3, // 7: pb.OriginServerService.updateOriginServer:output_type -> pb.UpdateOriginServerResponse
|
||||
5, // 8: pb.OriginServerService.findEnabledOriginServer:output_type -> pb.FindEnabledOriginServerResponse
|
||||
6, // [6:9] is the sub-list for method output_type
|
||||
3, // [3:6] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_origin_server_proto_init() }
|
||||
func file_service_origin_server_proto_init() {
|
||||
if File_service_origin_server_proto != nil {
|
||||
return
|
||||
}
|
||||
file_model_origin_server_proto_init()
|
||||
file_model_network_address_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_service_origin_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateOriginServerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_origin_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateOriginServerResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_origin_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateOriginServerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_origin_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateOriginServerResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_origin_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindEnabledOriginServerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_origin_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindEnabledOriginServerResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_origin_server_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_service_origin_server_proto_goTypes,
|
||||
DependencyIndexes: file_service_origin_server_proto_depIdxs,
|
||||
MessageInfos: file_service_origin_server_proto_msgTypes,
|
||||
}.Build()
|
||||
File_service_origin_server_proto = out.File
|
||||
file_service_origin_server_proto_rawDesc = nil
|
||||
file_service_origin_server_proto_goTypes = nil
|
||||
file_service_origin_server_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// OriginServerServiceClient is the client API for OriginServerService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type OriginServerServiceClient interface {
|
||||
// 创建源站
|
||||
CreateOriginServer(ctx context.Context, in *CreateOriginServerRequest, opts ...grpc.CallOption) (*CreateOriginServerResponse, error)
|
||||
// 修改源站
|
||||
UpdateOriginServer(ctx context.Context, in *UpdateOriginServerRequest, opts ...grpc.CallOption) (*UpdateOriginServerResponse, error)
|
||||
// 查找单个源站信息
|
||||
FindEnabledOriginServer(ctx context.Context, in *FindEnabledOriginServerRequest, opts ...grpc.CallOption) (*FindEnabledOriginServerResponse, error)
|
||||
}
|
||||
|
||||
type originServerServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewOriginServerServiceClient(cc grpc.ClientConnInterface) OriginServerServiceClient {
|
||||
return &originServerServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *originServerServiceClient) CreateOriginServer(ctx context.Context, in *CreateOriginServerRequest, opts ...grpc.CallOption) (*CreateOriginServerResponse, error) {
|
||||
out := new(CreateOriginServerResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.OriginServerService/createOriginServer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *originServerServiceClient) UpdateOriginServer(ctx context.Context, in *UpdateOriginServerRequest, opts ...grpc.CallOption) (*UpdateOriginServerResponse, error) {
|
||||
out := new(UpdateOriginServerResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.OriginServerService/updateOriginServer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *originServerServiceClient) FindEnabledOriginServer(ctx context.Context, in *FindEnabledOriginServerRequest, opts ...grpc.CallOption) (*FindEnabledOriginServerResponse, error) {
|
||||
out := new(FindEnabledOriginServerResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.OriginServerService/findEnabledOriginServer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// OriginServerServiceServer is the server API for OriginServerService service.
|
||||
type OriginServerServiceServer interface {
|
||||
// 创建源站
|
||||
CreateOriginServer(context.Context, *CreateOriginServerRequest) (*CreateOriginServerResponse, error)
|
||||
// 修改源站
|
||||
UpdateOriginServer(context.Context, *UpdateOriginServerRequest) (*UpdateOriginServerResponse, error)
|
||||
// 查找单个源站信息
|
||||
FindEnabledOriginServer(context.Context, *FindEnabledOriginServerRequest) (*FindEnabledOriginServerResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedOriginServerServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedOriginServerServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedOriginServerServiceServer) CreateOriginServer(context.Context, *CreateOriginServerRequest) (*CreateOriginServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateOriginServer not implemented")
|
||||
}
|
||||
func (*UnimplementedOriginServerServiceServer) UpdateOriginServer(context.Context, *UpdateOriginServerRequest) (*UpdateOriginServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateOriginServer not implemented")
|
||||
}
|
||||
func (*UnimplementedOriginServerServiceServer) FindEnabledOriginServer(context.Context, *FindEnabledOriginServerRequest) (*FindEnabledOriginServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledOriginServer not implemented")
|
||||
}
|
||||
|
||||
func RegisterOriginServerServiceServer(s *grpc.Server, srv OriginServerServiceServer) {
|
||||
s.RegisterService(&_OriginServerService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _OriginServerService_CreateOriginServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateOriginServerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OriginServerServiceServer).CreateOriginServer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.OriginServerService/CreateOriginServer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OriginServerServiceServer).CreateOriginServer(ctx, req.(*CreateOriginServerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _OriginServerService_UpdateOriginServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateOriginServerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OriginServerServiceServer).UpdateOriginServer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.OriginServerService/UpdateOriginServer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OriginServerServiceServer).UpdateOriginServer(ctx, req.(*UpdateOriginServerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _OriginServerService_FindEnabledOriginServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FindEnabledOriginServerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(OriginServerServiceServer).FindEnabledOriginServer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.OriginServerService/FindEnabledOriginServer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OriginServerServiceServer).FindEnabledOriginServer(ctx, req.(*FindEnabledOriginServerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _OriginServerService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.OriginServerService",
|
||||
HandlerType: (*OriginServerServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "createOriginServer",
|
||||
Handler: _OriginServerService_CreateOriginServer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "updateOriginServer",
|
||||
Handler: _OriginServerService_UpdateOriginServer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "findEnabledOriginServer",
|
||||
Handler: _OriginServerService_FindEnabledOriginServer_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_origin_server.proto",
|
||||
}
|
||||
1311
pkg/rpc/pb/service_server.pb.go
Normal file
1311
pkg/rpc/pb/service_server.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
66
pkg/rpc/pb/service_server_group.pb.go
Normal file
66
pkg/rpc/pb/service_server_group.pb.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_server_group.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
var File_service_server_group_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_server_group_proto_rawDesc = []byte{
|
||||
0x0a, 0x1a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62,
|
||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_service_server_group_proto_goTypes = []interface{}{}
|
||||
var file_service_server_group_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_server_group_proto_init() }
|
||||
func file_service_server_group_proto_init() {
|
||||
if File_service_server_group_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_server_group_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_service_server_group_proto_goTypes,
|
||||
DependencyIndexes: file_service_server_group_proto_depIdxs,
|
||||
}.Build()
|
||||
File_service_server_group_proto = out.File
|
||||
file_service_server_group_proto_rawDesc = nil
|
||||
file_service_server_group_proto_goTypes = nil
|
||||
file_service_server_group_proto_depIdxs = nil
|
||||
}
|
||||
66
pkg/rpc/pb/service_user.pb.go
Normal file
66
pkg/rpc/pb/service_user.pb.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.3
|
||||
// source: service_user.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
var File_service_user_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_user_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_service_user_proto_goTypes = []interface{}{}
|
||||
var file_service_user_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_user_proto_init() }
|
||||
func file_service_user_proto_init() {
|
||||
if File_service_user_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_user_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_service_user_proto_goTypes,
|
||||
DependencyIndexes: file_service_user_proto_depIdxs,
|
||||
}.Build()
|
||||
File_service_user_proto = out.File
|
||||
file_service_user_proto_rawDesc = nil
|
||||
file_service_user_proto_goTypes = nil
|
||||
file_service_user_proto_depIdxs = nil
|
||||
}
|
||||
18
pkg/rpc/protos/model_api_node.proto
Normal file
18
pkg/rpc/protos/model_api_node.proto
Normal file
@@ -0,0 +1,18 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message APINode {
|
||||
int64 id = 1;
|
||||
bool isOn = 2;
|
||||
int64 clusterId = 3;
|
||||
string uniqueId = 4;
|
||||
string secret = 5;
|
||||
string name = 6;
|
||||
string description = 7;
|
||||
string host = 8;
|
||||
int32 port = 9;
|
||||
|
||||
string address = 100;
|
||||
}
|
||||
10
pkg/rpc/protos/model_network_address.proto
Normal file
10
pkg/rpc/protos/model_network_address.proto
Normal file
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NetworkAddress {
|
||||
string protocol = 1;
|
||||
string host = 2;
|
||||
string portRange = 3;
|
||||
}
|
||||
23
pkg/rpc/protos/model_node.proto
Normal file
23
pkg/rpc/protos/model_node.proto
Normal file
@@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_node_cluster.proto";
|
||||
import "model_node_login.proto";
|
||||
import "model_node_install_status.proto";
|
||||
|
||||
message Node {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string status = 3;
|
||||
string installDir = 4;
|
||||
bool isInstalled = 5;
|
||||
string code = 6;
|
||||
string uniqueId = 7;
|
||||
string secret = 8;
|
||||
|
||||
NodeCluster cluster = 32;
|
||||
NodeLogin login = 33;
|
||||
NodeInstallStatus installStatus = 34;
|
||||
}
|
||||
12
pkg/rpc/protos/model_node_cluster.proto
Normal file
12
pkg/rpc/protos/model_node_cluster.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NodeCluster {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
int64 createdAt = 3;
|
||||
int64 grantId = 4;
|
||||
string installDir = 5;
|
||||
}
|
||||
16
pkg/rpc/protos/model_node_grant.proto
Normal file
16
pkg/rpc/protos/model_node_grant.proto
Normal file
@@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NodeGrant {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string method = 3;
|
||||
string username = 4;
|
||||
string password = 5;
|
||||
bool su = 6;
|
||||
string privateKey = 7;
|
||||
string description = 8;
|
||||
int64 nodeId = 9;
|
||||
}
|
||||
12
pkg/rpc/protos/model_node_install_status.proto
Normal file
12
pkg/rpc/protos/model_node_install_status.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NodeInstallStatus {
|
||||
bool isRunning = 1;
|
||||
bool isFinished = 2;
|
||||
bool isOk = 3;
|
||||
string error = 4;
|
||||
int64 updatedAt = 5;
|
||||
}
|
||||
14
pkg/rpc/protos/model_node_ip_address.proto
Normal file
14
pkg/rpc/protos/model_node_ip_address.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NodeIPAddress {
|
||||
int64 id = 1;
|
||||
int64 nodeId = 2;
|
||||
string name = 3;
|
||||
string ip = 4;
|
||||
string description = 5;
|
||||
int64 state = 6;
|
||||
int64 order = 7;
|
||||
}
|
||||
11
pkg/rpc/protos/model_node_login.proto
Normal file
11
pkg/rpc/protos/model_node_login.proto
Normal file
@@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message NodeLogin {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string type = 3;
|
||||
bytes params = 4;
|
||||
}
|
||||
14
pkg/rpc/protos/model_origin_server.proto
Normal file
14
pkg/rpc/protos/model_origin_server.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_network_address.proto";
|
||||
|
||||
message OriginServer {
|
||||
int64 id = 1;
|
||||
bool isOn = 2;
|
||||
string name = 3;
|
||||
NetworkAddress addr = 4;
|
||||
string description = 5;
|
||||
}
|
||||
19
pkg/rpc/protos/model_server.proto
Normal file
19
pkg/rpc/protos/model_server.proto
Normal file
@@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_node_cluster.proto";
|
||||
|
||||
message Server {
|
||||
int64 id = 1;
|
||||
bytes config = 2;
|
||||
string type = 3;
|
||||
string name = 4;
|
||||
string description = 5;
|
||||
bytes includeNodes = 6;
|
||||
bytes excludeNodes = 7;
|
||||
int64 createdAt = 8;
|
||||
|
||||
NodeCluster cluster = 10;
|
||||
}
|
||||
65
pkg/rpc/protos/service_admin.proto
Normal file
65
pkg/rpc/protos/service_admin.proto
Normal file
@@ -0,0 +1,65 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
|
||||
service AdminService {
|
||||
// 登录
|
||||
rpc loginAdmin (LoginAdminRequest) returns (LoginAdminResponse) {
|
||||
}
|
||||
|
||||
// 创建操作日志
|
||||
rpc createAdminLog (CreateAdminLogRequest) returns (CreateAdminLogResponse) {
|
||||
}
|
||||
|
||||
// 检查管理员是否存在
|
||||
rpc checkAdminExists (CheckAdminExistsRequest) returns (CheckAdminExistsResponse) {
|
||||
}
|
||||
|
||||
// 获取管理员名称
|
||||
rpc findAdminFullname (FindAdminFullnameRequest) returns (FindAdminFullnameResponse) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message LoginAdminRequest {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message LoginAdminResponse {
|
||||
int64 adminId = 1;
|
||||
bool isOk = 2;
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
message CreateAdminLogRequest {
|
||||
string level = 1;
|
||||
string description = 2;
|
||||
string action = 3;
|
||||
string ip = 4;
|
||||
}
|
||||
|
||||
message CreateAdminLogResponse {
|
||||
bool isOk = 1;
|
||||
}
|
||||
|
||||
message CheckAdminExistsRequest {
|
||||
int64 adminId = 1;
|
||||
}
|
||||
|
||||
message CheckAdminExistsResponse {
|
||||
bool isOk = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
|
||||
message FindAdminFullnameRequest {
|
||||
int64 adminId = 1;
|
||||
}
|
||||
|
||||
message FindAdminFullnameResponse {
|
||||
string fullname = 1;
|
||||
}
|
||||
|
||||
99
pkg/rpc/protos/service_api_node.proto
Normal file
99
pkg/rpc/protos/service_api_node.proto
Normal file
@@ -0,0 +1,99 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
import "model_api_node.proto";
|
||||
|
||||
service APINodeService {
|
||||
// 创建API节点
|
||||
rpc createAPINode (CreateAPINodeRequest) returns (CreateAPINodeResponse);
|
||||
|
||||
// 修改API节点
|
||||
rpc updateAPINode (UpdateAPINodeRequest) returns (UpdateAPINodeResponse);
|
||||
|
||||
// 删除API节点
|
||||
rpc deleteAPINode (DeleteAPINodeRequest) returns (DeleteAPINodeResponse);
|
||||
|
||||
// 列出所有可用API节点
|
||||
rpc findAllEnabledAPINodes (FindAllEnabledAPINodesRequest) returns (FindAllEnabledAPINodesResponse);
|
||||
|
||||
// 计算API节点数量
|
||||
rpc countAllEnabledAPINodes (CountAllEnabledAPINodesRequest) returns (CountAllEnabledAPINodesResponse);
|
||||
|
||||
// 列出单页的API节点
|
||||
rpc listEnabledAPINodes (ListEnabledAPINodesRequest) returns (ListEnabledAPINodesResponse);
|
||||
|
||||
// 根据ID查找节点
|
||||
rpc findEnabledAPINode (FindEnabledAPINodeRequest) returns (FindEnabledAPINodeResponse);
|
||||
}
|
||||
|
||||
// 创建API节点
|
||||
message CreateAPINodeRequest {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
string host = 3;
|
||||
int32 port = 4;
|
||||
}
|
||||
|
||||
message CreateAPINodeResponse {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
// 修改API节点
|
||||
message UpdateAPINodeRequest {
|
||||
int64 nodeId = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
string host = 4;
|
||||
int32 port = 5;
|
||||
}
|
||||
|
||||
message UpdateAPINodeResponse {
|
||||
|
||||
}
|
||||
|
||||
// 删除API节点
|
||||
message DeleteAPINodeRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message DeleteAPINodeResponse {
|
||||
|
||||
}
|
||||
|
||||
// 列出所有可用API节点
|
||||
message FindAllEnabledAPINodesRequest {
|
||||
|
||||
}
|
||||
|
||||
message FindAllEnabledAPINodesResponse {
|
||||
repeated APINode nodes = 1;
|
||||
}
|
||||
|
||||
// 计算API节点数量
|
||||
message CountAllEnabledAPINodesRequest {
|
||||
|
||||
}
|
||||
|
||||
message CountAllEnabledAPINodesResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 列出单页的API节点
|
||||
message ListEnabledAPINodesRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message ListEnabledAPINodesResponse {
|
||||
repeated APINode nodes = 1;
|
||||
}
|
||||
|
||||
// 根据ID查找节点
|
||||
message FindEnabledAPINodeRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledAPINodeResponse {
|
||||
APINode node = 1;
|
||||
}
|
||||
5
pkg/rpc/protos/service_log.proto
Normal file
5
pkg/rpc/protos/service_log.proto
Normal file
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
174
pkg/rpc/protos/service_node.proto
Normal file
174
pkg/rpc/protos/service_node.proto
Normal file
@@ -0,0 +1,174 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
import "model_node.proto";
|
||||
import "model_node_login.proto";
|
||||
|
||||
service NodeService {
|
||||
// 创建节点
|
||||
rpc createNode (CreateNodeRequest) returns (CreateNodeResponse);
|
||||
|
||||
// 节点数量
|
||||
rpc countAllEnabledNodes (CountAllEnabledNodesRequest) returns (CountAllEnabledNodesResponse);
|
||||
|
||||
// 计算匹配的节点数量
|
||||
rpc countAllEnabledNodesMatch (CountAllEnabledNodesMatchRequest) returns (CountAllEnabledNodesMatchResponse);
|
||||
|
||||
// 列出单页节点
|
||||
rpc listEnabledNodesMatch (ListEnabledNodesMatchRequest) returns (ListEnabledNodesMatchResponse);
|
||||
|
||||
// 禁用节点
|
||||
rpc disableNode (DisableNodeRequest) returns (DisableNodeResponse);
|
||||
|
||||
// 修改节点
|
||||
rpc updateNode (UpdateNodeRequest) returns (UpdateNodeResponse);
|
||||
|
||||
// 查看单个节点
|
||||
rpc findEnabledNode (FindEnabledNodeRequest) returns (FindEnabledNodeResponse);
|
||||
|
||||
// 组合单个节点配置
|
||||
rpc composeNodeConfig (ComposeNodeConfigRequest) returns (ComposeNodeConfigResponse);
|
||||
|
||||
// 节点stream
|
||||
rpc nodeStream (stream NodeStreamRequest) returns (stream NodeStreamResponse);
|
||||
|
||||
// 更新节点状态
|
||||
rpc updateNodeStatus (UpdateNodeStatusRequest) returns (UpdateNodeStatusResponse);
|
||||
|
||||
// 同步集群中的节点版本
|
||||
rpc syncNodesVersionWithCluster (SyncNodesVersionWithClusterRequest) returns (SyncNodesVersionWithClusterResponse);
|
||||
|
||||
// 修改节点安装状态
|
||||
rpc updateNodeIsInstalled (UpdateNodeIsInstalledRequest) returns (UpdateNodeIsInstalledResponse);
|
||||
|
||||
// 安装节点
|
||||
rpc installNode (InstallNodeRequest) returns (InstallNodeResponse);
|
||||
}
|
||||
|
||||
// 创建节点
|
||||
message CreateNodeRequest {
|
||||
string name = 1;
|
||||
int64 clusterId = 2;
|
||||
NodeLogin Login = 3;
|
||||
}
|
||||
|
||||
message CreateNodeResponse {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
// 节点数量
|
||||
message CountAllEnabledNodesRequest {
|
||||
|
||||
}
|
||||
|
||||
message CountAllEnabledNodesResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 列出单页节点
|
||||
message ListEnabledNodesMatchRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
int64 clusterId = 3;
|
||||
int32 installState = 4;
|
||||
}
|
||||
|
||||
message ListEnabledNodesMatchResponse {
|
||||
repeated Node nodes = 1;
|
||||
}
|
||||
|
||||
// 禁用节点
|
||||
message DisableNodeRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message DisableNodeResponse {
|
||||
|
||||
}
|
||||
|
||||
// 修改节点
|
||||
message UpdateNodeRequest {
|
||||
int64 nodeId = 1;
|
||||
string name = 2;
|
||||
int64 clusterId = 3;
|
||||
NodeLogin Login = 4;
|
||||
}
|
||||
|
||||
message UpdateNodeResponse {
|
||||
|
||||
}
|
||||
|
||||
// 查找节点
|
||||
message FindEnabledNodeRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledNodeResponse {
|
||||
Node node = 1;
|
||||
}
|
||||
|
||||
// 组合单个节点配置
|
||||
message ComposeNodeConfigRequest {
|
||||
|
||||
}
|
||||
|
||||
message ComposeNodeConfigResponse {
|
||||
bytes configJSON = 1;
|
||||
}
|
||||
|
||||
// 节点stream
|
||||
message NodeStreamRequest {
|
||||
|
||||
}
|
||||
|
||||
message NodeStreamResponse {
|
||||
|
||||
}
|
||||
|
||||
// 更新节点状态
|
||||
message UpdateNodeStatusRequest {
|
||||
int64 nodeId = 1;
|
||||
bytes statusJSON = 2;
|
||||
}
|
||||
|
||||
message UpdateNodeStatusResponse {
|
||||
|
||||
}
|
||||
|
||||
// 同步集群中的节点版本
|
||||
message SyncNodesVersionWithClusterRequest {
|
||||
int64 clusterId = 1;
|
||||
}
|
||||
|
||||
message SyncNodesVersionWithClusterResponse {
|
||||
}
|
||||
|
||||
// 计算匹配的节点数量
|
||||
message CountAllEnabledNodesMatchRequest {
|
||||
int64 clusterId = 1;
|
||||
int32 installState = 2;
|
||||
}
|
||||
|
||||
message CountAllEnabledNodesMatchResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 修改节点安装状态
|
||||
message UpdateNodeIsInstalledRequest {
|
||||
int64 nodeId = 1;
|
||||
bool isInstalled = 2;
|
||||
}
|
||||
|
||||
message UpdateNodeIsInstalledResponse {
|
||||
|
||||
}
|
||||
|
||||
// 安装节点
|
||||
message InstallNodeRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message InstallNodeResponse {
|
||||
|
||||
}
|
||||
109
pkg/rpc/protos/service_node_cluster.proto
Normal file
109
pkg/rpc/protos/service_node_cluster.proto
Normal file
@@ -0,0 +1,109 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
import "model_node_cluster.proto";
|
||||
|
||||
service NodeClusterService {
|
||||
// 创建集群
|
||||
rpc createNodeCluster (CreateNodeClusterRequest) returns (CreateNodeClusterResponse);
|
||||
|
||||
// 修改集群
|
||||
rpc updateNodeCluster (UpdateNodeClusterRequest) returns (UpdateNodeClusterResponse);
|
||||
|
||||
// 禁用集群
|
||||
rpc disableNodeCluster (DisableNodeClusterRequest) returns (DisableNodeClusterResponse);
|
||||
|
||||
// 查找单个集群信息
|
||||
rpc findEnabledNodeCluster (FindEnabledNodeClusterRequest) returns (FindEnabledNodeClusterResponse);
|
||||
|
||||
// 获取所有集群的信息
|
||||
rpc findAllEnabledNodeClusters (FindAllEnabledNodeClustersRequest) returns (FindAllEnabledNodeClustersResponse);
|
||||
|
||||
// 获取变更的集群
|
||||
rpc findAllChangedNodeClusters (FindAllChangedNodeClustersRequest) returns (FindAllChangedNodeClustersResponse);
|
||||
|
||||
// 计算所有集群数量
|
||||
rpc countAllEnabledNodeClusters (CountAllEnabledNodeClustersRequest) returns (CountAllEnabledNodeClustersResponse);
|
||||
|
||||
// 列出单页集群
|
||||
rpc listEnabledNodeClusters (ListEnabledNodeClustersRequest) returns (ListEnabledNodeClustersResponse);
|
||||
}
|
||||
|
||||
// 获取所有集群的信息
|
||||
message FindAllEnabledNodeClustersRequest {
|
||||
|
||||
}
|
||||
|
||||
message FindAllEnabledNodeClustersResponse {
|
||||
repeated NodeCluster clusters = 1;
|
||||
}
|
||||
|
||||
// 获取变更的集群
|
||||
message FindAllChangedNodeClustersRequest {
|
||||
|
||||
}
|
||||
|
||||
message FindAllChangedNodeClustersResponse {
|
||||
repeated NodeCluster clusters = 1;
|
||||
}
|
||||
|
||||
// 创建集群
|
||||
message CreateNodeClusterRequest {
|
||||
string name = 1;
|
||||
int64 grantId = 2;
|
||||
string installDir = 3;
|
||||
}
|
||||
|
||||
message CreateNodeClusterResponse {
|
||||
int64 clusterId = 1;
|
||||
}
|
||||
|
||||
// 修改集群
|
||||
message UpdateNodeClusterRequest {
|
||||
int64 clusterId = 1;
|
||||
string name = 2;
|
||||
int64 grantId = 3;
|
||||
string installDir = 4;
|
||||
}
|
||||
|
||||
message UpdateNodeClusterResponse {
|
||||
|
||||
}
|
||||
|
||||
// 禁用集群
|
||||
message DisableNodeClusterRequest {
|
||||
int64 clusterId = 1;
|
||||
}
|
||||
|
||||
message DisableNodeClusterResponse {
|
||||
|
||||
}
|
||||
|
||||
// 查找单个集群信息
|
||||
message FindEnabledNodeClusterRequest {
|
||||
int64 clusterId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledNodeClusterResponse {
|
||||
NodeCluster cluster = 1;
|
||||
}
|
||||
|
||||
// 计算所有集群数量
|
||||
message CountAllEnabledNodeClustersRequest {
|
||||
|
||||
}
|
||||
|
||||
message CountAllEnabledNodeClustersResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 列出单页集群
|
||||
message ListEnabledNodeClustersRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message ListEnabledNodeClustersResponse {
|
||||
repeated NodeCluster clusters = 1;
|
||||
}
|
||||
105
pkg/rpc/protos/service_node_grant.proto
Normal file
105
pkg/rpc/protos/service_node_grant.proto
Normal file
@@ -0,0 +1,105 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
import "model_node_grant.proto";
|
||||
|
||||
service NodeGrantService {
|
||||
// 创建认证
|
||||
rpc createNodeGrant (CreateNodeGrantRequest) returns (CreateNodeGrantResponse);
|
||||
|
||||
// 修改认证
|
||||
rpc updateNodeGrant (UpdateNodeGrantRequest) returns (UpdateNodeGrantResponse);
|
||||
|
||||
// 禁用认证
|
||||
rpc disableNodeGrant (DisableNodeGrantRequest) returns (DisableNodeGrantResponse);
|
||||
|
||||
// 计算认证的数量
|
||||
rpc countAllEnabledNodeGrants (CountAllEnabledNodeGrantsRequest) returns (CountAllEnabledNodeGrantsResponse);
|
||||
|
||||
// 列出单页认证
|
||||
rpc ListEnabledNodeGrants (ListEnabledNodeGrantsRequest) returns (ListEnabledNodeGrantsResponse);
|
||||
|
||||
// 列出所有认证
|
||||
rpc FindAllEnabledNodeGrants(FindAllEnabledNodeGrantsRequest) returns (FindAllEnabledNodeGrantsResponse);
|
||||
|
||||
// 获取单个认证信息
|
||||
rpc FindEnabledGrant(FindEnabledGrantRequest) returns (FindEnabledGrantResponse);
|
||||
}
|
||||
|
||||
// 创建节点认证
|
||||
message CreateNodeGrantRequest {
|
||||
string name = 1;
|
||||
string method = 2;
|
||||
string username = 3;
|
||||
string password = 4;
|
||||
string privateKey = 5;
|
||||
string description = 6;
|
||||
int64 nodeId = 7;
|
||||
}
|
||||
|
||||
message CreateNodeGrantResponse {
|
||||
int64 grantId = 1;
|
||||
}
|
||||
|
||||
// 修改节点认证
|
||||
message UpdateNodeGrantRequest {
|
||||
int64 grantId = 8;
|
||||
string name = 1;
|
||||
string method = 2;
|
||||
string username = 3;
|
||||
string password = 4;
|
||||
string privateKey = 5;
|
||||
string description = 6;
|
||||
int64 nodeId = 7;
|
||||
}
|
||||
|
||||
message UpdateNodeGrantResponse {
|
||||
|
||||
}
|
||||
|
||||
// 禁用节点认证
|
||||
message DisableNodeGrantRequest {
|
||||
int64 grantId = 1;
|
||||
}
|
||||
|
||||
message DisableNodeGrantResponse {
|
||||
|
||||
}
|
||||
|
||||
// 计算节点认证数量
|
||||
message CountAllEnabledNodeGrantsRequest {
|
||||
|
||||
}
|
||||
|
||||
message CountAllEnabledNodeGrantsResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 列出单页认证
|
||||
message ListEnabledNodeGrantsRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message ListEnabledNodeGrantsResponse {
|
||||
repeated NodeGrant grants = 1;
|
||||
}
|
||||
|
||||
// 获取所有认证信息
|
||||
message FindAllEnabledNodeGrantsRequest {
|
||||
|
||||
}
|
||||
|
||||
message FindAllEnabledNodeGrantsResponse {
|
||||
repeated NodeGrant grants = 1;
|
||||
}
|
||||
|
||||
// 获取认证信息
|
||||
message FindEnabledGrantRequest {
|
||||
int64 grantId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledGrantResponse {
|
||||
NodeGrant grant = 1;
|
||||
}
|
||||
5
pkg/rpc/protos/service_node_group.proto
Normal file
5
pkg/rpc/protos/service_node_group.proto
Normal file
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
97
pkg/rpc/protos/service_node_ip_address.proto
Normal file
97
pkg/rpc/protos/service_node_ip_address.proto
Normal file
@@ -0,0 +1,97 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_node_ip_address.proto";
|
||||
|
||||
service NodeIPAddressService {
|
||||
// 创建IP地址
|
||||
rpc createNodeIPAddress (CreateNodeIPAddressRequest) returns (CreateNodeIPAddressResponse);
|
||||
|
||||
// 修改IP地址
|
||||
rpc updateNodeIPAddress (UpdateNodeIPAddressRequest) returns (UpdateNodeIPAddressResponse);
|
||||
|
||||
// 修改IP地址所属节点
|
||||
rpc updateNodeIPAddressNodeId (UpdateNodeIPAddressNodeIdRequest) returns (UpdateNodeIPAddressNodeIdResponse);
|
||||
|
||||
// 禁用单个IP地址
|
||||
rpc disableNodeIPAddress (DisableNodeIPAddressRequest) returns (DisableNodeIPAddressResponse);
|
||||
|
||||
// 禁用节点的所有IP地址
|
||||
rpc disableAllIPAddressesWithNodeId (DisableAllIPAddressesWithNodeIdRequest) returns (DisableAllIPAddressesWithNodeIdResponse);
|
||||
|
||||
// 查找单个IP地址
|
||||
rpc findEnabledNodeIPAddress (FindEnabledNodeIPAddressRequest) returns (FindEnabledNodeIPAddressResponse);
|
||||
|
||||
// 查找节点的所有地址
|
||||
rpc findAllEnabledIPAddressesWithNodeId (FindAllEnabledIPAddressesWithNodeIdRequest) returns (FindAllEnabledIPAddressesWithNodeIdResponse);
|
||||
}
|
||||
|
||||
// 创建IP地址
|
||||
message CreateNodeIPAddressRequest {
|
||||
int64 nodeId = 1;
|
||||
string name = 2;
|
||||
string ip = 3;
|
||||
}
|
||||
|
||||
message CreateNodeIPAddressResponse {
|
||||
int64 addressId = 1;
|
||||
}
|
||||
|
||||
// 修改IP地址
|
||||
message UpdateNodeIPAddressRequest {
|
||||
int64 addressId = 1;
|
||||
string name = 2;
|
||||
string ip = 3;
|
||||
}
|
||||
|
||||
message UpdateNodeIPAddressResponse {
|
||||
|
||||
}
|
||||
|
||||
// 修改IP地址所属节点
|
||||
message UpdateNodeIPAddressNodeIdRequest {
|
||||
int64 addressId = 1;
|
||||
int64 nodeId = 2;
|
||||
}
|
||||
|
||||
message UpdateNodeIPAddressNodeIdResponse {
|
||||
|
||||
}
|
||||
|
||||
// 禁用单个IP地址
|
||||
message DisableNodeIPAddressRequest {
|
||||
int64 addressId = 1;
|
||||
}
|
||||
|
||||
message DisableNodeIPAddressResponse {
|
||||
|
||||
}
|
||||
|
||||
// 禁用节点的所有IP地址
|
||||
message DisableAllIPAddressesWithNodeIdRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message DisableAllIPAddressesWithNodeIdResponse {
|
||||
|
||||
}
|
||||
|
||||
// 查找单个IP地址
|
||||
message FindEnabledNodeIPAddressRequest {
|
||||
int64 addressId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledNodeIPAddressResponse {
|
||||
NodeIPAddress ipAddress = 1;
|
||||
}
|
||||
|
||||
// 查找节点的所有地址
|
||||
message FindAllEnabledIPAddressesWithNodeIdRequest {
|
||||
int64 nodeId = 1;
|
||||
}
|
||||
|
||||
message FindAllEnabledIPAddressesWithNodeIdResponse {
|
||||
repeated NodeIPAddress addresses = 1;
|
||||
}
|
||||
5
pkg/rpc/protos/service_node_region.proto
Normal file
5
pkg/rpc/protos/service_node_region.proto
Normal file
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
50
pkg/rpc/protos/service_origin_server.proto
Normal file
50
pkg/rpc/protos/service_origin_server.proto
Normal file
@@ -0,0 +1,50 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "model_origin_server.proto";
|
||||
import "model_network_address.proto";
|
||||
|
||||
service OriginServerService {
|
||||
// 创建源站
|
||||
rpc createOriginServer (CreateOriginServerRequest) returns (CreateOriginServerResponse);
|
||||
|
||||
// 修改源站
|
||||
rpc updateOriginServer (UpdateOriginServerRequest) returns (UpdateOriginServerResponse);
|
||||
|
||||
// 查找单个源站信息
|
||||
rpc findEnabledOriginServer (FindEnabledOriginServerRequest) returns (FindEnabledOriginServerResponse);
|
||||
}
|
||||
|
||||
// 创建源站
|
||||
message CreateOriginServerRequest {
|
||||
string name = 1;
|
||||
NetworkAddress addr = 2;
|
||||
string description = 3;
|
||||
}
|
||||
|
||||
message CreateOriginServerResponse {
|
||||
int64 originId = 1;
|
||||
}
|
||||
|
||||
// 修改源站
|
||||
message UpdateOriginServerRequest {
|
||||
int64 originId = 1;
|
||||
string name = 2;
|
||||
NetworkAddress addr = 3;
|
||||
string description = 4;
|
||||
}
|
||||
|
||||
message UpdateOriginServerResponse {
|
||||
|
||||
}
|
||||
|
||||
// 查找单个源站信息
|
||||
message FindEnabledOriginServerRequest {
|
||||
int64 originId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledOriginServerResponse {
|
||||
OriginServer Origin = 1;
|
||||
}
|
||||
96
pkg/rpc/protos/service_server.proto
Normal file
96
pkg/rpc/protos/service_server.proto
Normal file
@@ -0,0 +1,96 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
import "model_server.proto";
|
||||
|
||||
service ServerService {
|
||||
// 创建服务
|
||||
rpc createServer (CreateServerRequest) returns (CreateServerResponse);
|
||||
|
||||
// 修改服务
|
||||
rpc updateServer (UpdateServerRequest) returns (UpdateServerResponse);
|
||||
|
||||
// 计算服务数量
|
||||
rpc countAllEnabledServers (CountAllEnabledServersRequest) returns (CountAllEnabledServersResponse);
|
||||
|
||||
// 列出单页服务
|
||||
rpc listEnabledServers (ListEnabledServersRequest) returns (ListEnabledServersResponse);
|
||||
|
||||
// 禁用某服务
|
||||
rpc disableServer (DisableServerRequest) returns (DisableServerResponse);
|
||||
|
||||
// 查找单个服务
|
||||
rpc findEnabledServer (FindEnabledServerRequest) returns (FindEnabledServerResponse);
|
||||
}
|
||||
|
||||
// 创建服务
|
||||
message CreateServerRequest {
|
||||
int64 userId = 1;
|
||||
int64 adminId = 2;
|
||||
string type = 3;
|
||||
string name = 4;
|
||||
string description = 5;
|
||||
int64 clusterId = 6;
|
||||
bytes config = 7;
|
||||
bytes includeNodesJSON = 8;
|
||||
bytes excludeNodesJSON = 9;
|
||||
}
|
||||
|
||||
message CreateServerResponse {
|
||||
int64 serverId = 1;
|
||||
}
|
||||
|
||||
// 修改服务
|
||||
message UpdateServerRequest {
|
||||
int64 serverId = 1;
|
||||
int64 userId = 2;
|
||||
int64 adminId = 3;
|
||||
string name = 4;
|
||||
string description = 5;
|
||||
int64 clusterId = 6;
|
||||
bytes config = 7;
|
||||
bytes includeNodesJSON = 8;
|
||||
bytes excludeNodesJSON = 9;
|
||||
}
|
||||
|
||||
message UpdateServerResponse {
|
||||
|
||||
}
|
||||
|
||||
// 计算服务数量
|
||||
message CountAllEnabledServersRequest {
|
||||
|
||||
}
|
||||
|
||||
message CountAllEnabledServersResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 列出单页服务
|
||||
message ListEnabledServersRequest {
|
||||
int64 offset = 1;
|
||||
int64 size = 2;
|
||||
}
|
||||
|
||||
message ListEnabledServersResponse {
|
||||
repeated Server servers = 1;
|
||||
}
|
||||
|
||||
// 禁用服务
|
||||
message DisableServerRequest {
|
||||
int64 serverId = 1;
|
||||
}
|
||||
|
||||
message DisableServerResponse {
|
||||
|
||||
}
|
||||
|
||||
// 查找单个服务
|
||||
message FindEnabledServerRequest {
|
||||
int64 serverId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledServerResponse {
|
||||
Server server = 1;
|
||||
}
|
||||
5
pkg/rpc/protos/service_server_group.proto
Normal file
5
pkg/rpc/protos/service_server_group.proto
Normal file
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
5
pkg/rpc/protos/service_user.proto
Normal file
5
pkg/rpc/protos/service_user.proto
Normal file
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
155
pkg/serverconfigs/cache_policy.go
Normal file
155
pkg/serverconfigs/cache_policy.go
Normal file
@@ -0,0 +1,155 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/configutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"github.com/iwind/TeaGo/files"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var DefaultSkippedResponseCacheControlValues = []string{"private", "no-cache", "no-store"}
|
||||
|
||||
// 缓存策略配置
|
||||
type CachePolicy struct {
|
||||
Id int `yaml:"id" json:"id"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 TODO
|
||||
Name string `yaml:"name" json:"name"` // 名称
|
||||
|
||||
Key string `yaml:"key" json:"key"` // 每个缓存的Key规则,里面可以有变量
|
||||
Capacity shared.SizeCapacity `yaml:"capacity" json:"capacity"` // 最大内容容量
|
||||
Life shared.TimeDuration `yaml:"life" json:"life"` // 时间
|
||||
Status []int `yaml:"status" json:"status"` // 缓存的状态码列表
|
||||
MaxSize shared.SizeCapacity `yaml:"maxSize" json:"maxSize"` // 能够请求的最大尺寸
|
||||
|
||||
SkipResponseCacheControlValues []string `yaml:"skipCacheControlValues" json:"skipCacheControlValues"` // 可以跳过的响应的Cache-Control值
|
||||
SkipResponseSetCookie bool `yaml:"skipSetCookie" json:"skipSetCookie"` // 是否跳过响应的Set-Cookie Header
|
||||
EnableRequestCachePragma bool `yaml:"enableRequestCachePragma" json:"enableRequestCachePragma"` // 是否支持客户端的Pragma: no-cache
|
||||
|
||||
Cond []*shared.RequestCond `yaml:"cond" json:"cond"`
|
||||
|
||||
life time.Duration
|
||||
maxSize int64
|
||||
capacity int64
|
||||
|
||||
uppercaseSkipCacheControlValues []string
|
||||
|
||||
Type string `yaml:"type" json:"type"` // 类型
|
||||
Options map[string]interface{} `yaml:"options" json:"options"` // 选项
|
||||
}
|
||||
|
||||
// 获取新对象
|
||||
func NewCachePolicy() *CachePolicy {
|
||||
return &CachePolicy{
|
||||
SkipResponseCacheControlValues: DefaultSkippedResponseCacheControlValues,
|
||||
SkipResponseSetCookie: true,
|
||||
}
|
||||
}
|
||||
|
||||
// 从文件中读取缓存策略
|
||||
func NewCachePolicyFromFile(file string) *CachePolicy {
|
||||
if len(file) == 0 {
|
||||
return nil
|
||||
}
|
||||
reader, err := files.NewReader(Tea.ConfigFile(file))
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
return nil
|
||||
}
|
||||
defer func() {
|
||||
_ = reader.Close()
|
||||
}()
|
||||
|
||||
p := NewCachePolicy()
|
||||
err = reader.ReadYAML(p)
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
// 校验
|
||||
func (this *CachePolicy) Validate() error {
|
||||
var err error
|
||||
this.maxSize = this.MaxSize.Bytes()
|
||||
this.life = this.Life.Duration()
|
||||
this.capacity = this.Capacity.Bytes()
|
||||
|
||||
this.uppercaseSkipCacheControlValues = []string{}
|
||||
for _, value := range this.SkipResponseCacheControlValues {
|
||||
this.uppercaseSkipCacheControlValues = append(this.uppercaseSkipCacheControlValues, strings.ToUpper(value))
|
||||
}
|
||||
|
||||
// cond
|
||||
if len(this.Cond) > 0 {
|
||||
for _, cond := range this.Cond {
|
||||
err := cond.Validate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// 最大数据尺寸
|
||||
func (this *CachePolicy) MaxDataSize() int64 {
|
||||
return this.maxSize
|
||||
}
|
||||
|
||||
// 容量
|
||||
func (this *CachePolicy) CapacitySize() int64 {
|
||||
return this.capacity
|
||||
}
|
||||
|
||||
// 生命周期
|
||||
func (this *CachePolicy) LifeDuration() time.Duration {
|
||||
return this.life
|
||||
}
|
||||
|
||||
// 保存
|
||||
func (this *CachePolicy) Save() error {
|
||||
shared.Locker.Lock()
|
||||
defer shared.Locker.Unlock()
|
||||
|
||||
filename := "cache.policy." + strconv.Itoa(this.Id) + ".conf"
|
||||
writer, err := files.NewWriter(Tea.ConfigFile(filename))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = writer.Close()
|
||||
}()
|
||||
_, err = writer.WriteYAML(this)
|
||||
return err
|
||||
}
|
||||
|
||||
// 删除
|
||||
func (this *CachePolicy) Delete() error {
|
||||
filename := "cache.policy." + strconv.Itoa(this.Id) + ".conf"
|
||||
return files.NewFile(Tea.ConfigFile(filename)).Delete()
|
||||
}
|
||||
|
||||
// 是否包含某个Cache-Control值
|
||||
func (this *CachePolicy) ContainsCacheControl(value string) bool {
|
||||
return lists.ContainsString(this.uppercaseSkipCacheControlValues, strings.ToUpper(value))
|
||||
}
|
||||
|
||||
// 检查是否匹配关键词
|
||||
func (this *CachePolicy) MatchKeyword(keyword string) (matched bool, name string, tags []string) {
|
||||
if configutils.MatchKeyword(this.Name, keyword) || configutils.MatchKeyword(this.Type, keyword) {
|
||||
matched = true
|
||||
name = this.Name
|
||||
if len(this.Type) > 0 {
|
||||
tags = []string{"类型:" + this.Type}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
4
pkg/serverconfigs/component_config.go
Normal file
4
pkg/serverconfigs/component_config.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package serverconfigs
|
||||
|
||||
type ComponentConfig struct {
|
||||
}
|
||||
20
pkg/serverconfigs/configutils/copy.go
Normal file
20
pkg/serverconfigs/configutils/copy.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// 拷贝同类型struct指针对象中的字段
|
||||
func CopyStructObject(destPtr, sourcePtr interface{}) {
|
||||
value := reflect.ValueOf(destPtr)
|
||||
value2 := reflect.ValueOf(sourcePtr)
|
||||
|
||||
countFields := value2.Elem().NumField()
|
||||
for i := 0; i < countFields; i++ {
|
||||
v := value2.Elem().Field(i)
|
||||
if !v.IsValid() || !v.CanSet() {
|
||||
continue
|
||||
}
|
||||
value.Elem().Field(i).Set(v)
|
||||
}
|
||||
}
|
||||
28
pkg/serverconfigs/configutils/copy_test.go
Normal file
28
pkg/serverconfigs/configutils/copy_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCopyStructObject(t *testing.T) {
|
||||
type Book struct {
|
||||
Name string
|
||||
Price int
|
||||
Year int
|
||||
Author string
|
||||
press string
|
||||
}
|
||||
|
||||
book1 := &Book{
|
||||
Name: "Hello Golang",
|
||||
Price: 100,
|
||||
Year: 2020,
|
||||
Author: "Liu",
|
||||
press: "Beijing",
|
||||
}
|
||||
book2 := new(Book)
|
||||
CopyStructObject(book2, book1)
|
||||
logs.PrintAsJSON(book2, t)
|
||||
logs.PrintAsJSON(book1, t)
|
||||
}
|
||||
59
pkg/serverconfigs/configutils/domain.go
Normal file
59
pkg/serverconfigs/configutils/domain.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/utils/string"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 从一组规则中匹配域名
|
||||
// 支持的格式:example.com, www.example.com, .example.com, *.example.com, ~(\d+).example.com
|
||||
// 更多参考:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
|
||||
func MatchDomains(patterns []string, domain string) (isMatched bool) {
|
||||
if len(patterns) == 0 {
|
||||
return
|
||||
}
|
||||
for _, pattern := range patterns {
|
||||
if matchDomain(pattern, domain) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 匹配单个域名规则
|
||||
func matchDomain(pattern string, domain string) (isMatched bool) {
|
||||
if len(pattern) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// 正则表达式
|
||||
if pattern[0] == '~' {
|
||||
reg, err := stringutil.RegexpCompile(strings.TrimSpace(pattern[1:]))
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
return false
|
||||
}
|
||||
return reg.MatchString(domain)
|
||||
}
|
||||
|
||||
if pattern[0] == '.' {
|
||||
return strings.HasSuffix(domain, pattern)
|
||||
}
|
||||
|
||||
// 其他匹配
|
||||
patternPieces := strings.Split(pattern, ".")
|
||||
domainPieces := strings.Split(domain, ".")
|
||||
if len(patternPieces) != len(domainPieces) {
|
||||
return
|
||||
}
|
||||
isMatched = true
|
||||
for index, patternPiece := range patternPieces {
|
||||
if patternPiece == "" || patternPiece == "*" || patternPiece == domainPieces[index] {
|
||||
continue
|
||||
}
|
||||
isMatched = false
|
||||
break
|
||||
}
|
||||
return isMatched
|
||||
}
|
||||
79
pkg/serverconfigs/configutils/domain_test.go
Normal file
79
pkg/serverconfigs/configutils/domain_test.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMatchDomain(t *testing.T) {
|
||||
a := assert.NewAssertion(t)
|
||||
{
|
||||
ok := MatchDomains([]string{}, "example.com")
|
||||
a.IsFalse(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"example.com"}, "example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"www.example.com"}, "example.com")
|
||||
a.IsFalse(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{".example.com"}, "www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{".example.com"}, "a.www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{".example.com"}, "a.www.example123.com")
|
||||
a.IsFalse(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"*.example.com"}, "www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"*.*.com"}, "www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"www.*.com"}, "www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"gallery.*.com"}, "www.example.com")
|
||||
a.IsFalse(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"~\\w+.example.com"}, "www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"~\\w+.example.com"}, "a.www.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"~^\\d+.example.com$"}, "www.example.com")
|
||||
a.IsFalse(ok)
|
||||
}
|
||||
|
||||
{
|
||||
ok := MatchDomains([]string{"~^\\d+.example.com$"}, "123.example.com")
|
||||
a.IsTrue(ok)
|
||||
}
|
||||
}
|
||||
11
pkg/serverconfigs/configutils/log.go
Normal file
11
pkg/serverconfigs/configutils/log.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package configutils
|
||||
|
||||
import "github.com/iwind/TeaGo/logs"
|
||||
|
||||
// 记录错误
|
||||
func LogError(arg ...interface{}) {
|
||||
if len(arg) == 0 {
|
||||
return
|
||||
}
|
||||
logs.Println(arg...)
|
||||
}
|
||||
25
pkg/serverconfigs/configutils/match.go
Normal file
25
pkg/serverconfigs/configutils/match.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var whitespaceReg = regexp.MustCompile(`\s+`)
|
||||
|
||||
// 关键词匹配
|
||||
func MatchKeyword(source, keyword string) bool {
|
||||
if len(keyword) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
pieces := whitespaceReg.Split(keyword, -1)
|
||||
source = strings.ToLower(source)
|
||||
for _, piece := range pieces {
|
||||
if strings.Index(source, strings.ToLower(piece)) > -1 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
13
pkg/serverconfigs/configutils/match_test.go
Normal file
13
pkg/serverconfigs/configutils/match_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMatchKeyword(t *testing.T) {
|
||||
a := assert.NewAssertion(t)
|
||||
a.IsTrue(MatchKeyword("a b c", "a"))
|
||||
a.IsFalse(MatchKeyword("a b c", ""))
|
||||
a.IsTrue(MatchKeyword("abc", "BC"))
|
||||
}
|
||||
14
pkg/serverconfigs/configutils/yaml.go
Normal file
14
pkg/serverconfigs/configutils/yaml.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package configutils
|
||||
|
||||
import (
|
||||
"github.com/go-yaml/yaml"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func UnmarshalYamlFile(file string, ptr interface{}) error {
|
||||
data, err := ioutil.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return yaml.Unmarshal(data, ptr)
|
||||
}
|
||||
4
pkg/serverconfigs/filter_config.go
Normal file
4
pkg/serverconfigs/filter_config.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package serverconfigs
|
||||
|
||||
type FilterConfig struct {
|
||||
}
|
||||
43
pkg/serverconfigs/global_config.go
Normal file
43
pkg/serverconfigs/global_config.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/configutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
)
|
||||
|
||||
var globalConfig *GlobalConfig = nil
|
||||
var globalConfigFile = "global.yaml"
|
||||
|
||||
// 全局设置
|
||||
type GlobalConfig struct {
|
||||
HTTPAll struct {
|
||||
MatchDomainStrictly bool `yaml:"matchDomainStrictly" json:"matchDomainStrictly"`
|
||||
} `yaml:"httpAll" json:"httpAll"`
|
||||
HTTP struct{} `yaml:"http" json:"http"`
|
||||
HTTPS struct{} `yaml:"https" json:"https"`
|
||||
TCPAll struct{} `yaml:"tcpAll" json:"tcpAll"`
|
||||
TCP struct{} `yaml:"tcp" json:"tcp"`
|
||||
TLS struct{} `yaml:"tls" json:"tls"`
|
||||
Unix struct{} `yaml:"unix" json:"unix"`
|
||||
UDP struct{} `yaml:"udp" json:"udp"`
|
||||
}
|
||||
|
||||
func SharedGlobalConfig() *GlobalConfig {
|
||||
shared.Locker.Lock()
|
||||
defer shared.Locker.Unlock()
|
||||
|
||||
if globalConfig != nil {
|
||||
return globalConfig
|
||||
}
|
||||
|
||||
err := configutils.UnmarshalYamlFile(globalConfigFile, globalConfig)
|
||||
if err != nil {
|
||||
configutils.LogError("[SharedGlobalConfig]" + err.Error())
|
||||
globalConfig = &GlobalConfig{}
|
||||
}
|
||||
return globalConfig
|
||||
}
|
||||
|
||||
func (this *GlobalConfig) Init() error {
|
||||
return nil
|
||||
}
|
||||
11
pkg/serverconfigs/health_check_config.go
Normal file
11
pkg/serverconfigs/health_check_config.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
|
||||
type HealthCheckConfig struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 TODO
|
||||
URL string `yaml:"url" json:"url"` // TODO
|
||||
Interval int `yaml:"interval" json:"interval"` // TODO
|
||||
StatusCodes []int `yaml:"statusCodes" json:"statusCodes"` // TODO
|
||||
Timeout shared.TimeDuration `yaml:"timeout" json:"timeout"` // 超时时间 TODO
|
||||
}
|
||||
8
pkg/serverconfigs/ip_version.go
Normal file
8
pkg/serverconfigs/ip_version.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package serverconfigs
|
||||
|
||||
type IPVersion = string
|
||||
|
||||
const (
|
||||
IPv4 IPVersion = "4"
|
||||
IPv6 IPVersion = "6"
|
||||
)
|
||||
4
pkg/serverconfigs/location_config.go
Normal file
4
pkg/serverconfigs/location_config.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package serverconfigs
|
||||
|
||||
type LocationConfig struct {
|
||||
}
|
||||
70
pkg/serverconfigs/network_address_config.go
Normal file
70
pkg/serverconfigs/network_address_config.go
Normal file
@@ -0,0 +1,70 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var regexpSinglePort = regexp.MustCompile(`^\d+$`)
|
||||
|
||||
// 网络地址配置
|
||||
type NetworkAddressConfig struct {
|
||||
Protocol string `yaml:"protocol" json:"protocol"` // 协议,http、tcp、tcp4、tcp6、unix、udp等
|
||||
Host string `yaml:"host" json:"host"` // 主机地址或主机名
|
||||
PortRange string `yaml:"portRange" json:"portRange"` // 端口范围,支持 8080、8080-8090、8080:8090
|
||||
|
||||
minPort int
|
||||
maxPort int
|
||||
}
|
||||
|
||||
func (this *NetworkAddressConfig) Init() error {
|
||||
// 8080
|
||||
if regexpSinglePort.MatchString(this.PortRange) {
|
||||
this.minPort = types.Int(this.PortRange)
|
||||
this.maxPort = this.minPort
|
||||
return nil
|
||||
}
|
||||
|
||||
// 8080:8090
|
||||
if strings.Contains(this.PortRange, ":") {
|
||||
pieces := strings.SplitN(this.PortRange, ":", 2)
|
||||
minPort := types.Int(pieces[0])
|
||||
maxPort := types.Int(pieces[1])
|
||||
if minPort > maxPort {
|
||||
minPort, maxPort = maxPort, minPort
|
||||
}
|
||||
this.minPort = minPort
|
||||
this.maxPort = maxPort
|
||||
return nil
|
||||
}
|
||||
|
||||
// 8080-8090
|
||||
if strings.Contains(this.PortRange, "-") {
|
||||
pieces := strings.SplitN(this.PortRange, "-", 2)
|
||||
minPort := types.Int(pieces[0])
|
||||
maxPort := types.Int(pieces[1])
|
||||
if minPort > maxPort {
|
||||
minPort, maxPort = maxPort, minPort
|
||||
}
|
||||
this.minPort = minPort
|
||||
this.maxPort = maxPort
|
||||
return nil
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *NetworkAddressConfig) FullAddresses() []string {
|
||||
if this.Protocol == ProtocolUnix {
|
||||
return []string{this.Protocol + ":" + this.Host}
|
||||
}
|
||||
|
||||
result := []string{}
|
||||
for i := this.minPort; i <= this.maxPort; i++ {
|
||||
host := this.Host
|
||||
result = append(result, this.Protocol+"://"+host+":"+strconv.Itoa(i))
|
||||
}
|
||||
return result
|
||||
}
|
||||
57
pkg/serverconfigs/network_address_config_test.go
Normal file
57
pkg/serverconfigs/network_address_config_test.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package serverconfigs
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNetworkAddressConfig_FullAddresses(t *testing.T) {
|
||||
{
|
||||
addr := &NetworkAddressConfig{
|
||||
Protocol: "http",
|
||||
Host: "127.0.0.1",
|
||||
PortRange: "8080",
|
||||
}
|
||||
err := addr.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(addr.FullAddresses())
|
||||
}
|
||||
|
||||
{
|
||||
addr := &NetworkAddressConfig{
|
||||
Protocol: "http",
|
||||
Host: "127.0.0.1",
|
||||
PortRange: "8080:8090",
|
||||
}
|
||||
err := addr.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(addr.FullAddresses())
|
||||
}
|
||||
|
||||
{
|
||||
addr := &NetworkAddressConfig{
|
||||
Protocol: "http",
|
||||
Host: "127.0.0.1",
|
||||
PortRange: "8080-8090",
|
||||
}
|
||||
err := addr.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(addr.FullAddresses())
|
||||
}
|
||||
|
||||
{
|
||||
addr := &NetworkAddressConfig{
|
||||
Protocol: "http",
|
||||
Host: "127.0.0.1",
|
||||
PortRange: "8080-8070",
|
||||
}
|
||||
err := addr.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(addr.FullAddresses())
|
||||
}
|
||||
}
|
||||
176
pkg/serverconfigs/origin_server_config.go
Normal file
176
pkg/serverconfigs/origin_server_config.go
Normal file
@@ -0,0 +1,176 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 源站服务配置
|
||||
type OriginServerConfig struct {
|
||||
Id int64 `yaml:"id" json:"id"` // ID
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 TODO
|
||||
Version int `yaml:"version" json:"version"` // 版本
|
||||
Name string `yaml:"name" json:"name"` // 名称 TODO
|
||||
Addr *NetworkAddressConfig `yaml:"addr" json:"addr"` // 地址
|
||||
Description string `yaml:"description" json:"description"` // 描述 TODO
|
||||
Code string `yaml:"code" json:"code"` // 代号 TODO
|
||||
|
||||
Weight uint `yaml:"weight" json:"weight"` // 权重 TODO
|
||||
IsBackup bool `yaml:"backup" json:"isBackup"` // 是否为备份 TODO
|
||||
ConnTimeout shared.TimeDuration `yaml:"failTimeout" json:"failTimeout"` // 连接失败超时 TODO
|
||||
ReadTimeout shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间 TODO
|
||||
IdleTimeout shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间 TODO
|
||||
MaxFails int32 `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
|
||||
CurrentFails int32 `yaml:"currentFails" json:"currentFails"` // 当前已失败次数 TODO
|
||||
MaxConns int32 `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 TODO
|
||||
CurrentConns int32 `yaml:"currentConns" json:"currentConns"` // 当前连接数 TODO
|
||||
MaxIdleConns int32 `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数 TODO
|
||||
|
||||
IsDown bool `yaml:"down" json:"isDown"` // 是否下线 TODO
|
||||
DownTime time.Time `yaml:"downTime,omitempty" json:"downTime,omitempty"` // 下线时间 TODO
|
||||
|
||||
RequestURI string `yaml:"requestURI" json:"requestURI"` // 转发后的请求URI TODO
|
||||
Host string `yaml:"host" json:"host"` // 自定义主机名 TODO
|
||||
|
||||
RequestHeaders *shared.HTTPHeadersConfig `yaml:"requestHeaders" json:"requestHeaders"` // 请求Header设置 TODO
|
||||
ResponseHeaders *shared.HTTPHeadersConfig `yaml:"responseHeaders" json:"responseHeaders"`
|
||||
|
||||
// 健康检查URL,目前支持:
|
||||
// - http|https 返回2xx-3xx认为成功
|
||||
HealthCheck *HealthCheckConfig `yaml:"healthCheck" json:"healthCheck"`
|
||||
|
||||
Cert *sslconfigs.SSLCertConfig `yaml:"cert" json:"cert"` // 请求源服务器用的证书
|
||||
|
||||
// ftp
|
||||
FTP *OriginServerFTPConfig `yaml:"ftp" json:"ftp"`
|
||||
|
||||
connTimeoutDuration time.Duration
|
||||
readTimeoutDuration time.Duration
|
||||
idleTimeoutDuration time.Duration
|
||||
|
||||
hasRequestURI bool
|
||||
requestPath string
|
||||
requestArgs string
|
||||
|
||||
hasRequestHeaders bool
|
||||
hasResponseHeaders bool
|
||||
|
||||
hasHost bool
|
||||
|
||||
uniqueKey string
|
||||
|
||||
hasAddrVariables bool // 地址中是否含有变量
|
||||
}
|
||||
|
||||
// 校验
|
||||
func (this *OriginServerConfig) Init() error {
|
||||
// 证书
|
||||
if this.Cert != nil {
|
||||
err := this.Cert.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// unique key
|
||||
this.uniqueKey = strconv.FormatInt(this.Id, 10) + "@" + fmt.Sprintf("%d", this.Version)
|
||||
|
||||
// failTimeout
|
||||
this.connTimeoutDuration = this.ConnTimeout.Duration()
|
||||
|
||||
// readTimeout
|
||||
this.readTimeoutDuration = this.ReadTimeout.Duration()
|
||||
|
||||
// idleTimeout
|
||||
this.idleTimeoutDuration = this.IdleTimeout.Duration()
|
||||
|
||||
// Headers
|
||||
if this.RequestHeaders != nil {
|
||||
err := this.RequestHeaders.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if this.ResponseHeaders != nil {
|
||||
err := this.ResponseHeaders.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// request uri
|
||||
if len(this.RequestURI) == 0 || this.RequestURI == "${requestURI}" {
|
||||
this.hasRequestURI = false
|
||||
} else {
|
||||
this.hasRequestURI = true
|
||||
|
||||
if strings.Contains(this.RequestURI, "?") {
|
||||
pieces := strings.SplitN(this.RequestURI, "?", -1)
|
||||
this.requestPath = pieces[0]
|
||||
this.requestArgs = pieces[1]
|
||||
} else {
|
||||
this.requestPath = this.RequestURI
|
||||
}
|
||||
}
|
||||
|
||||
// TODO init health check
|
||||
|
||||
// headers
|
||||
this.hasRequestHeaders = this.RequestHeaders != nil && !this.RequestHeaders.IsEmpty()
|
||||
this.hasRequestHeaders = this.ResponseHeaders != nil && !this.ResponseHeaders.IsEmpty()
|
||||
|
||||
// host
|
||||
this.hasHost = len(this.Host) > 0
|
||||
|
||||
// variables
|
||||
// TODO 在host和port中支持变量
|
||||
this.hasAddrVariables = false
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 候选对象代号
|
||||
func (this *OriginServerConfig) CandidateCodes() []string {
|
||||
codes := []string{strconv.FormatInt(this.Id, 10)}
|
||||
if len(this.Code) > 0 {
|
||||
codes = append(codes, this.Code)
|
||||
}
|
||||
return codes
|
||||
}
|
||||
|
||||
// 候选对象权重
|
||||
func (this *OriginServerConfig) CandidateWeight() uint {
|
||||
return this.Weight
|
||||
}
|
||||
|
||||
// 连接源站
|
||||
func (this *OriginServerConfig) Connect() (net.Conn, error) {
|
||||
if this.Addr == nil {
|
||||
return nil, errors.New("origin server address should not be empty")
|
||||
}
|
||||
|
||||
switch this.Addr.Protocol {
|
||||
case "", ProtocolTCP:
|
||||
// TODO 支持TCP4/TCP6
|
||||
// TODO 支持指定特定网卡
|
||||
// TODO Addr支持端口范围,如果有多个端口时,随机一个端口使用
|
||||
return net.DialTimeout("tcp", this.Addr.Host+":"+this.Addr.PortRange, this.connTimeoutDuration)
|
||||
case ProtocolTLS:
|
||||
// TODO 支持TCP4/TCP6
|
||||
// TODO 支持指定特定网卡
|
||||
// TODO Addr支持端口范围,如果有多个端口时,随机一个端口使用
|
||||
// TODO 支持使用证书
|
||||
return tls.Dial("tcp", this.Addr.Host+":"+this.Addr.PortRange, &tls.Config{})
|
||||
}
|
||||
|
||||
// TODO 支持从Unix、Pipe、HTTP、HTTPS中读取数据
|
||||
|
||||
return nil, errors.New("invalid scheme '" + this.Addr.Protocol + "'")
|
||||
}
|
||||
8
pkg/serverconfigs/origin_server_ftp.go
Normal file
8
pkg/serverconfigs/origin_server_ftp.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package serverconfigs
|
||||
|
||||
// FTP源站配置
|
||||
type OriginServerFTPConfig struct {
|
||||
Username string `yaml:"username" json:"username"` // 用户名
|
||||
Password string `yaml:"password" json:"password"` // 密码
|
||||
Dir string `yaml:"dir" json:"dir"` // 目录
|
||||
}
|
||||
6
pkg/serverconfigs/origin_server_group_config.go
Normal file
6
pkg/serverconfigs/origin_server_group_config.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package serverconfigs
|
||||
|
||||
// TODO 需要实现
|
||||
type OriginServerGroupConfig struct {
|
||||
Origins []*OriginServerConfig `yaml:"origins" json:"origins"` // 源站列表
|
||||
}
|
||||
29
pkg/serverconfigs/protocol.go
Normal file
29
pkg/serverconfigs/protocol.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package serverconfigs
|
||||
|
||||
type Protocol = string
|
||||
|
||||
const (
|
||||
ProtocolHTTP Protocol = "http"
|
||||
ProtocolHTTPS Protocol = "https"
|
||||
ProtocolTCP Protocol = "tcp"
|
||||
ProtocolTLS Protocol = "tls"
|
||||
ProtocolUnix Protocol = "unix"
|
||||
ProtocolUDP Protocol = "udp"
|
||||
|
||||
// 子协议
|
||||
ProtocolHTTP4 Protocol = "http4"
|
||||
ProtocolHTTP6 Protocol = "http6"
|
||||
|
||||
ProtocolHTTPS4 Protocol = "https4"
|
||||
ProtocolHTTPS6 Protocol = "https6"
|
||||
|
||||
ProtocolTCP4 Protocol = "tcp4"
|
||||
ProtocolTCP6 Protocol = "tcp6"
|
||||
|
||||
ProtocolTLS4 Protocol = "tls4"
|
||||
ProtocolTLS6 Protocol = "tls6"
|
||||
)
|
||||
|
||||
func AllProtocols() []Protocol {
|
||||
return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolTCP, ProtocolTLS, ProtocolUnix, ProtocolUDP, ProtocolHTTP4, ProtocolHTTP6, ProtocolHTTPS4, ProtocolHTTPS6, ProtocolTCP4, ProtocolTCP6, ProtocolTLS4, ProtocolTLS6}
|
||||
}
|
||||
32
pkg/serverconfigs/protocol_base.go
Normal file
32
pkg/serverconfigs/protocol_base.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package serverconfigs
|
||||
|
||||
// 协议基础数据结构
|
||||
type BaseProtocol struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
Listen []*NetworkAddressConfig `yaml:"listen" json:"listen"` // 绑定的网络地址
|
||||
}
|
||||
|
||||
// 初始化
|
||||
func (this *BaseProtocol) InitBase() error {
|
||||
for _, addr := range this.Listen {
|
||||
err := addr.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取完整的地址列表
|
||||
func (this *BaseProtocol) FullAddresses() []string {
|
||||
result := []string{}
|
||||
for _, addr := range this.Listen {
|
||||
result = append(result, addr.FullAddresses()...)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// 添加地址
|
||||
func (this *BaseProtocol) AddListen(addr ...*NetworkAddressConfig) {
|
||||
this.Listen = append(this.Listen, addr...)
|
||||
}
|
||||
14
pkg/serverconfigs/protocol_http_config.go
Normal file
14
pkg/serverconfigs/protocol_http_config.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
}
|
||||
|
||||
func (this *HTTPProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
24
pkg/serverconfigs/protocol_https_config.go
Normal file
24
pkg/serverconfigs/protocol_https_config.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
|
||||
|
||||
// TLS Version
|
||||
type TLSVersion = string
|
||||
|
||||
// Cipher Suites
|
||||
type TLSCipherSuite = string
|
||||
|
||||
type HTTPSProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
|
||||
SSL *sslconfigs.SSLConfig `yaml:"ssl"`
|
||||
}
|
||||
|
||||
func (this *HTTPSProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
14
pkg/serverconfigs/protocol_tcp_config.go
Normal file
14
pkg/serverconfigs/protocol_tcp_config.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package serverconfigs
|
||||
|
||||
type TCPProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
}
|
||||
|
||||
func (this *TCPProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
19
pkg/serverconfigs/protocol_tls_config.go
Normal file
19
pkg/serverconfigs/protocol_tls_config.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
|
||||
|
||||
type TLSProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
|
||||
SSL *sslconfigs.SSLConfig `yaml:"ssl" json:"ssl"`
|
||||
}
|
||||
|
||||
// 初始化
|
||||
func (this *TLSProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
14
pkg/serverconfigs/protocol_udp_config.go
Normal file
14
pkg/serverconfigs/protocol_udp_config.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package serverconfigs
|
||||
|
||||
type UDPProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
}
|
||||
|
||||
func (this *UDPProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
14
pkg/serverconfigs/protocol_unix_config.go
Normal file
14
pkg/serverconfigs/protocol_unix_config.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package serverconfigs
|
||||
|
||||
type UnixProtocolConfig struct {
|
||||
BaseProtocol `yaml:",inline"`
|
||||
}
|
||||
|
||||
func (this *UnixProtocolConfig) Init() error {
|
||||
err := this.InitBase()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
105
pkg/serverconfigs/reverse_proxy_config.go
Normal file
105
pkg/serverconfigs/reverse_proxy_config.go
Normal file
@@ -0,0 +1,105 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/scheduling"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// 反向代理设置
|
||||
type ReverseProxyConfig struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 TODO
|
||||
Origins []*OriginServerConfig `yaml:"origins" json:"origins"` // 源站列表
|
||||
Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项
|
||||
|
||||
hasOrigins bool
|
||||
schedulingIsBackup bool
|
||||
schedulingObject scheduling.SchedulingInterface
|
||||
schedulingLocker sync.Mutex
|
||||
}
|
||||
|
||||
// 初始化
|
||||
func (this *ReverseProxyConfig) Init() error {
|
||||
this.hasOrigins = len(this.Origins) > 0
|
||||
|
||||
for _, origin := range this.Origins {
|
||||
err := origin.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// scheduling
|
||||
this.SetupScheduling(false)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 取得下一个可用的后端服务
|
||||
func (this *ReverseProxyConfig) NextOrigin(call *shared.RequestCall) *OriginServerConfig {
|
||||
this.schedulingLocker.Lock()
|
||||
defer this.schedulingLocker.Unlock()
|
||||
|
||||
if this.schedulingObject == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if this.Scheduling != nil && call != nil && call.Options != nil {
|
||||
for k, v := range this.Scheduling.Options {
|
||||
call.Options[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
candidate := this.schedulingObject.Next(call)
|
||||
if candidate == nil {
|
||||
// 启用备用服务器
|
||||
if !this.schedulingIsBackup {
|
||||
this.SetupScheduling(true)
|
||||
|
||||
candidate = this.schedulingObject.Next(call)
|
||||
if candidate == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if candidate == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return candidate.(*OriginServerConfig)
|
||||
}
|
||||
|
||||
// 设置调度算法
|
||||
func (this *ReverseProxyConfig) SetupScheduling(isBackup bool) {
|
||||
if !isBackup {
|
||||
this.schedulingLocker.Lock()
|
||||
defer this.schedulingLocker.Unlock()
|
||||
}
|
||||
this.schedulingIsBackup = isBackup
|
||||
|
||||
if this.Scheduling == nil {
|
||||
this.schedulingObject = &scheduling.RandomScheduling{}
|
||||
} else {
|
||||
typeCode := this.Scheduling.Code
|
||||
s := scheduling.FindSchedulingType(typeCode)
|
||||
if s == nil {
|
||||
this.Scheduling = nil
|
||||
this.schedulingObject = &scheduling.RandomScheduling{}
|
||||
} else {
|
||||
this.schedulingObject = s["instance"].(scheduling.SchedulingInterface)
|
||||
}
|
||||
}
|
||||
|
||||
for _, origin := range this.Origins {
|
||||
if origin.IsOn && !origin.IsDown {
|
||||
if isBackup && origin.IsBackup {
|
||||
this.schedulingObject.Add(origin)
|
||||
} else if !isBackup && !origin.IsBackup {
|
||||
this.schedulingObject.Add(origin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.schedulingObject.Start()
|
||||
}
|
||||
10
pkg/serverconfigs/scheduling/candidate.go
Normal file
10
pkg/serverconfigs/scheduling/candidate.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package scheduling
|
||||
|
||||
// 候选对象接口
|
||||
type CandidateInterface interface {
|
||||
// 权重
|
||||
CandidateWeight() uint
|
||||
|
||||
// 代号
|
||||
CandidateCodes() []string
|
||||
}
|
||||
39
pkg/serverconfigs/scheduling/scheduling.go
Normal file
39
pkg/serverconfigs/scheduling/scheduling.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
// 调度算法接口
|
||||
type SchedulingInterface interface {
|
||||
// 是否有候选对象
|
||||
HasCandidates() bool
|
||||
|
||||
// 添加候选对象
|
||||
Add(candidate ...CandidateInterface)
|
||||
|
||||
// 启动
|
||||
Start()
|
||||
|
||||
// 查找下一个候选对象
|
||||
Next(call *shared.RequestCall) CandidateInterface
|
||||
|
||||
// 获取简要信息
|
||||
Summary() maps.Map
|
||||
}
|
||||
|
||||
// 调度算法基础类
|
||||
type Scheduling struct {
|
||||
Candidates []CandidateInterface
|
||||
}
|
||||
|
||||
// 判断是否有候选对象
|
||||
func (this *Scheduling) HasCandidates() bool {
|
||||
return len(this.Candidates) > 0
|
||||
}
|
||||
|
||||
// 添加候选对象
|
||||
func (this *Scheduling) Add(candidate ...CandidateInterface) {
|
||||
this.Candidates = append(this.Candidates, candidate...)
|
||||
}
|
||||
45
pkg/serverconfigs/scheduling/scheduling_hash.go
Normal file
45
pkg/serverconfigs/scheduling/scheduling_hash.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"hash/crc32"
|
||||
)
|
||||
|
||||
// Hash调度算法
|
||||
type HashScheduling struct {
|
||||
Scheduling
|
||||
|
||||
count uint32
|
||||
}
|
||||
|
||||
// 启动
|
||||
func (this *HashScheduling) Start() {
|
||||
this.count = uint32(len(this.Candidates))
|
||||
}
|
||||
|
||||
// 获取下一个候选对象
|
||||
func (this *HashScheduling) Next(call *shared.RequestCall) CandidateInterface {
|
||||
if this.count == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
key := call.Options.GetString("key")
|
||||
|
||||
if call.Formatter != nil {
|
||||
key = call.Formatter(key)
|
||||
}
|
||||
|
||||
sum := crc32.ChecksumIEEE([]byte(key))
|
||||
return this.Candidates[sum%this.count]
|
||||
}
|
||||
|
||||
// 获取简要信息
|
||||
func (this *HashScheduling) Summary() maps.Map {
|
||||
return maps.Map{
|
||||
"code": "hash",
|
||||
"name": "Hash算法",
|
||||
"description": "根据自定义的键值的Hash值分配后端服务器",
|
||||
"networks": []string{"http"},
|
||||
}
|
||||
}
|
||||
45
pkg/serverconfigs/scheduling/scheduling_hash_test.go
Normal file
45
pkg/serverconfigs/scheduling/scheduling_hash_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestHashScheduling_Next(t *testing.T) {
|
||||
s := &HashScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 30,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
hits := map[string]uint{}
|
||||
for _, c := range s.Candidates {
|
||||
hits[c.(*TestCandidate).Name] = 0
|
||||
}
|
||||
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
for i := 0; i < 1000000; i ++ {
|
||||
call := shared.NewRequestCall()
|
||||
call.Options["key"] = "192.168.1." + fmt.Sprintf("%d", rand.Int())
|
||||
|
||||
c := s.Next(call)
|
||||
hits[c.(*TestCandidate).Name] ++
|
||||
}
|
||||
t.Log(hits)
|
||||
}
|
||||
78
pkg/serverconfigs/scheduling/scheduling_random.go
Normal file
78
pkg/serverconfigs/scheduling/scheduling_random.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"math"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 随机调度算法
|
||||
type RandomScheduling struct {
|
||||
Scheduling
|
||||
|
||||
array []CandidateInterface
|
||||
count uint // 实际总的服务器数
|
||||
}
|
||||
|
||||
// 启动
|
||||
func (this *RandomScheduling) Start() {
|
||||
sumWeight := uint(0)
|
||||
for _, c := range this.Candidates {
|
||||
weight := c.CandidateWeight()
|
||||
if weight == 0 {
|
||||
weight = 1
|
||||
} else if weight > 10000 {
|
||||
weight = 10000
|
||||
}
|
||||
sumWeight += weight
|
||||
}
|
||||
|
||||
if sumWeight == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, c := range this.Candidates {
|
||||
weight := c.CandidateWeight()
|
||||
if weight == 0 {
|
||||
weight = 1
|
||||
} else if weight > 10000 {
|
||||
weight = 10000
|
||||
}
|
||||
count := uint(0)
|
||||
if sumWeight <= 1000 {
|
||||
count = weight
|
||||
} else {
|
||||
count = uint(math.Round(float64(weight*10000) / float64(sumWeight))) // 1% 产生 100个数据,最多支持10000个服务器
|
||||
}
|
||||
for i := uint(0); i < count; i++ {
|
||||
this.array = append(this.array, c)
|
||||
}
|
||||
this.count += count
|
||||
}
|
||||
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// 获取下一个候选对象
|
||||
func (this *RandomScheduling) Next(call *shared.RequestCall) CandidateInterface {
|
||||
if this.count == 0 {
|
||||
return nil
|
||||
}
|
||||
if this.count == 1 {
|
||||
return this.array[0]
|
||||
}
|
||||
index := rand.Int() % int(this.count)
|
||||
return this.array[index]
|
||||
}
|
||||
|
||||
// 获取简要信息
|
||||
func (this *RandomScheduling) Summary() maps.Map {
|
||||
return maps.Map{
|
||||
"code": "random",
|
||||
"name": "Random随机算法",
|
||||
"description": "根据权重设置随机分配后端服务器",
|
||||
"networks": []string{"http", "tcp"},
|
||||
}
|
||||
}
|
||||
79
pkg/serverconfigs/scheduling/scheduling_random_test.go
Normal file
79
pkg/serverconfigs/scheduling/scheduling_random_test.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type TestCandidate struct {
|
||||
Name string
|
||||
Weight uint
|
||||
}
|
||||
|
||||
func (this *TestCandidate) CandidateWeight() uint {
|
||||
return this.Weight
|
||||
}
|
||||
|
||||
func (this *TestCandidate) CandidateCodes() []string {
|
||||
return []string{this.Name}
|
||||
}
|
||||
|
||||
func TestRandomScheduling_Next(t *testing.T) {
|
||||
s := &RandomScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 30,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
/**for _, c := range s.array {
|
||||
t.Log(c.(*TestCandidate).Name, ":", c.CandidateWeight())
|
||||
}**/
|
||||
|
||||
hits := map[string]uint{}
|
||||
for _, c := range s.array {
|
||||
hits[c.(*TestCandidate).Name] = 0
|
||||
}
|
||||
|
||||
t.Log("count:", s.count, "array length:", len(s.array))
|
||||
|
||||
var locker sync.Mutex
|
||||
var wg = sync.WaitGroup{}
|
||||
wg.Add(100 * 10000)
|
||||
for i := 0; i < 100*10000; i ++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
c := s.Next(nil)
|
||||
|
||||
locker.Lock()
|
||||
defer locker.Unlock()
|
||||
hits[c.(*TestCandidate).Name] ++
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
t.Log(hits)
|
||||
}
|
||||
|
||||
func TestRandomScheduling_NextZero(t *testing.T) {
|
||||
s := &RandomScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 0,
|
||||
})
|
||||
s.Start()
|
||||
t.Log(s.Next(nil))
|
||||
}
|
||||
80
pkg/serverconfigs/scheduling/scheduling_round_robin.go
Normal file
80
pkg/serverconfigs/scheduling/scheduling_round_robin.go
Normal file
@@ -0,0 +1,80 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// 轮询调度算法
|
||||
type RoundRobinScheduling struct {
|
||||
Scheduling
|
||||
|
||||
rawWeights []uint
|
||||
currentWeights []uint
|
||||
count uint
|
||||
index uint
|
||||
|
||||
locker sync.Mutex
|
||||
}
|
||||
|
||||
// 启动
|
||||
func (this *RoundRobinScheduling) Start() {
|
||||
lists.Sort(this.Candidates, func(i int, j int) bool {
|
||||
c1 := this.Candidates[i]
|
||||
c2 := this.Candidates[j]
|
||||
return c1.CandidateWeight() > c2.CandidateWeight()
|
||||
})
|
||||
|
||||
for _, c := range this.Candidates {
|
||||
weight := c.CandidateWeight()
|
||||
if weight == 0 {
|
||||
weight = 1
|
||||
} else if weight > 10000 {
|
||||
weight = 10000
|
||||
}
|
||||
this.rawWeights = append(this.rawWeights, weight)
|
||||
}
|
||||
|
||||
this.currentWeights = append([]uint{}, this.rawWeights...)
|
||||
this.count = uint(len(this.Candidates))
|
||||
}
|
||||
|
||||
// 获取下一个候选对象
|
||||
func (this *RoundRobinScheduling) Next(call *shared.RequestCall) CandidateInterface {
|
||||
if this.count == 0 {
|
||||
return nil
|
||||
}
|
||||
this.locker.Lock()
|
||||
defer this.locker.Unlock()
|
||||
|
||||
if this.index > this.count-1 {
|
||||
this.index = 0
|
||||
}
|
||||
weight := this.currentWeights[this.index]
|
||||
|
||||
// 已经一轮了,则重置状态
|
||||
if weight == 0 {
|
||||
if this.currentWeights[0] == 0 {
|
||||
this.currentWeights = append([]uint{}, this.rawWeights...)
|
||||
}
|
||||
this.index = 0
|
||||
weight = this.currentWeights[this.index]
|
||||
}
|
||||
|
||||
c := this.Candidates[this.index]
|
||||
this.currentWeights[this.index] --
|
||||
this.index++
|
||||
return c
|
||||
}
|
||||
|
||||
// 获取简要信息
|
||||
func (this *RoundRobinScheduling) Summary() maps.Map {
|
||||
return maps.Map{
|
||||
"code": "roundRobin",
|
||||
"name": "RoundRobin轮询算法",
|
||||
"description": "根据权重,依次分配后端服务器",
|
||||
"networks": []string{"http", "tcp"},
|
||||
}
|
||||
}
|
||||
101
pkg/serverconfigs/scheduling/scheduling_round_robin_test.go
Normal file
101
pkg/serverconfigs/scheduling/scheduling_round_robin_test.go
Normal file
@@ -0,0 +1,101 @@
|
||||
package scheduling
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRoundRobinScheduling_Next(t *testing.T) {
|
||||
s := &RoundRobinScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 5,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 20,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 30,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
for _, c := range s.Candidates {
|
||||
t.Log(c.(*TestCandidate).Name, c.CandidateWeight())
|
||||
}
|
||||
|
||||
t.Log(s.currentWeights)
|
||||
|
||||
for i := 0; i < 100; i ++ {
|
||||
t.Log("===", "round", i, "===")
|
||||
t.Log(s.Next(nil))
|
||||
t.Log(s.currentWeights)
|
||||
t.Log(s.rawWeights)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRoundRobinScheduling_Two(t *testing.T) {
|
||||
s := &RoundRobinScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 10,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
for _, c := range s.Candidates {
|
||||
t.Log(c.(*TestCandidate).Name, c.CandidateWeight())
|
||||
}
|
||||
|
||||
t.Log(s.currentWeights)
|
||||
|
||||
for i := 0; i < 100; i ++ {
|
||||
t.Log("===", "round", i, "===")
|
||||
t.Log(s.Next(nil))
|
||||
t.Log(s.currentWeights)
|
||||
t.Log(s.rawWeights)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRoundRobinScheduling_NextPerformance(t *testing.T) {
|
||||
s := &RoundRobinScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 1,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 2,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 3,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 6,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
for _, c := range s.Candidates {
|
||||
t.Log(c.(*TestCandidate).Name, c.CandidateWeight())
|
||||
}
|
||||
|
||||
t.Log(s.currentWeights)
|
||||
|
||||
hits := map[string]uint{}
|
||||
for _, c := range s.Candidates {
|
||||
hits[c.(*TestCandidate).Name] = 0
|
||||
}
|
||||
for i := 0; i < 100*10000; i ++ {
|
||||
c := s.Next(nil)
|
||||
hits[c.(*TestCandidate).Name] ++
|
||||
}
|
||||
|
||||
t.Log(hits)
|
||||
}
|
||||
106
pkg/serverconfigs/scheduling/scheduling_sticky.go
Normal file
106
pkg/serverconfigs/scheduling/scheduling_sticky.go
Normal file
@@ -0,0 +1,106 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Sticky调度算法
|
||||
type StickyScheduling struct {
|
||||
Scheduling
|
||||
|
||||
count uint32
|
||||
mapping map[string]CandidateInterface // code => candidate
|
||||
}
|
||||
|
||||
// 启动
|
||||
func (this *StickyScheduling) Start() {
|
||||
this.mapping = map[string]CandidateInterface{}
|
||||
for _, c := range this.Candidates {
|
||||
for _, code := range c.CandidateCodes() {
|
||||
this.mapping[code] = c
|
||||
}
|
||||
}
|
||||
|
||||
this.count = uint32(len(this.Candidates))
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// 获取下一个候选对象
|
||||
func (this *StickyScheduling) Next(call *shared.RequestCall) CandidateInterface {
|
||||
if this.count == 0 {
|
||||
return nil
|
||||
}
|
||||
typeCode := call.Options.GetString("type")
|
||||
param := call.Options.GetString("param")
|
||||
|
||||
if call.Request == nil {
|
||||
return this.Candidates[uint32(rand.Int())%this.count]
|
||||
}
|
||||
|
||||
code := ""
|
||||
if typeCode == "cookie" {
|
||||
cookie, err := call.Request.Cookie(param)
|
||||
if err == nil {
|
||||
code = cookie.Value
|
||||
}
|
||||
} else if typeCode == "header" {
|
||||
code = call.Request.Header.Get(param)
|
||||
} else if typeCode == "argument" {
|
||||
code = call.Request.URL.Query().Get(param)
|
||||
}
|
||||
|
||||
matched := false
|
||||
var c CandidateInterface = nil
|
||||
|
||||
defer func() {
|
||||
if !matched && c != nil {
|
||||
codes := c.CandidateCodes()
|
||||
if len(codes) == 0 {
|
||||
return
|
||||
}
|
||||
if typeCode == "cookie" {
|
||||
call.AddResponseCall(func(resp http.ResponseWriter) {
|
||||
http.SetCookie(resp, &http.Cookie{
|
||||
Name: param,
|
||||
Value: codes[0],
|
||||
Path: "/",
|
||||
Expires: time.Now().AddDate(0, 1, 0),
|
||||
})
|
||||
})
|
||||
} else {
|
||||
call.AddResponseCall(func(resp http.ResponseWriter) {
|
||||
resp.Header().Set(param, codes[0])
|
||||
})
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if len(code) == 0 {
|
||||
c = this.Candidates[uint32(rand.Int())%this.count]
|
||||
return c
|
||||
}
|
||||
|
||||
found := false
|
||||
c, found = this.mapping[code]
|
||||
if !found {
|
||||
c = this.Candidates[uint32(rand.Int())%this.count]
|
||||
return c
|
||||
}
|
||||
|
||||
matched = true
|
||||
return c
|
||||
}
|
||||
|
||||
// 获取简要信息
|
||||
func (this *StickyScheduling) Summary() maps.Map {
|
||||
return maps.Map{
|
||||
"code": "sticky",
|
||||
"name": "Sticky算法",
|
||||
"description": "利用Cookie、URL参数或者HTTP Header来指定后端服务器",
|
||||
"networks": []string{"http"},
|
||||
}
|
||||
}
|
||||
128
pkg/serverconfigs/scheduling/scheduling_sticky_test.go
Normal file
128
pkg/serverconfigs/scheduling/scheduling_sticky_test.go
Normal file
@@ -0,0 +1,128 @@
|
||||
package scheduling
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStickyScheduling_NextArgument(t *testing.T) {
|
||||
s := &StickyScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 1,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 2,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 3,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 6,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
t.Log(s.mapping)
|
||||
|
||||
req, err := http.NewRequest("GET", "http://www.example.com/?backend=c", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
options := maps.Map{
|
||||
"type": "argument",
|
||||
"param": "backend",
|
||||
}
|
||||
call := shared.NewRequestCall()
|
||||
call.Request = req
|
||||
call.Options = options
|
||||
t.Log(s.Next(call))
|
||||
t.Log(options)
|
||||
}
|
||||
|
||||
func TestStickyScheduling_NextCookie(t *testing.T) {
|
||||
s := &StickyScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 1,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 2,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 3,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 6,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
t.Log(s.mapping)
|
||||
|
||||
req, err := http.NewRequest("GET", "http://www.example.com/?backend=c", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req.AddCookie(&http.Cookie{
|
||||
Name: "backend",
|
||||
Value: "c",
|
||||
})
|
||||
|
||||
options := maps.Map{
|
||||
"type": "cookie",
|
||||
"param": "backend",
|
||||
}
|
||||
call := shared.NewRequestCall()
|
||||
call.Request = req
|
||||
call.Options = options
|
||||
t.Log(s.Next(call))
|
||||
t.Log(options)
|
||||
}
|
||||
|
||||
func TestStickyScheduling_NextHeader(t *testing.T) {
|
||||
s := &StickyScheduling{}
|
||||
s.Add(&TestCandidate{
|
||||
Name: "a",
|
||||
Weight: 1,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "b",
|
||||
Weight: 2,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "c",
|
||||
Weight: 3,
|
||||
})
|
||||
s.Add(&TestCandidate{
|
||||
Name: "d",
|
||||
Weight: 6,
|
||||
})
|
||||
s.Start()
|
||||
|
||||
t.Log(s.mapping)
|
||||
|
||||
req, err := http.NewRequest("GET", "http://www.example.com/?backend=c", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
req.Header.Set("backend", "c")
|
||||
|
||||
options := maps.Map{
|
||||
"type": "header",
|
||||
"param": "backend",
|
||||
}
|
||||
call := shared.NewRequestCall()
|
||||
call.Request = req
|
||||
call.Options = options
|
||||
t.Log(s.Next(call))
|
||||
t.Log(options)
|
||||
}
|
||||
28
pkg/serverconfigs/scheduling/utils.go
Normal file
28
pkg/serverconfigs/scheduling/utils.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package scheduling
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
// 所有请求类型
|
||||
func AllSchedulingTypes() []maps.Map {
|
||||
types := []maps.Map{}
|
||||
for _, s := range []SchedulingInterface{
|
||||
new(RandomScheduling),
|
||||
new(RoundRobinScheduling),
|
||||
new(HashScheduling),
|
||||
new(StickyScheduling),
|
||||
} {
|
||||
summary := s.Summary()
|
||||
summary["instance"] = s
|
||||
types = append(types, summary)
|
||||
}
|
||||
return types
|
||||
}
|
||||
|
||||
func FindSchedulingType(code string) maps.Map {
|
||||
for _, summary := range AllSchedulingTypes() {
|
||||
if summary["code"] == code {
|
||||
return summary
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
14
pkg/serverconfigs/scheduling_config.go
Normal file
14
pkg/serverconfigs/scheduling_config.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/iwind/TeaGo/maps"
|
||||
|
||||
// 调度算法配置
|
||||
type SchedulingConfig struct {
|
||||
Code string `yaml:"code" json:"code"` // 类型
|
||||
Options maps.Map `yaml:"options" json:"options"` // 选项
|
||||
}
|
||||
|
||||
// 获取新对象
|
||||
func NewSchedulingConfig() *SchedulingConfig {
|
||||
return &SchedulingConfig{}
|
||||
}
|
||||
192
pkg/serverconfigs/server_config.go
Normal file
192
pkg/serverconfigs/server_config.go
Normal file
@@ -0,0 +1,192 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
|
||||
)
|
||||
|
||||
type ServerConfig struct {
|
||||
Id string `yaml:"id" json:"id"` // ID
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
Components []*ComponentConfig `yaml:"components" json:"components"` // 组件
|
||||
Filters []*FilterConfig `yaml:"filters" json:"filters"` // 过滤器
|
||||
Name string `yaml:"name" json:"name"` // 名称
|
||||
Description string `yaml:"description" json:"description"` // 描述
|
||||
ServerNames []*ServerNameConfig `yaml:"serverNames" json:"serverNames"` // 域名
|
||||
|
||||
// 前端协议
|
||||
HTTP *HTTPProtocolConfig `yaml:"http" json:"http"` // HTTP配置
|
||||
HTTPS *HTTPSProtocolConfig `yaml:"https" json:"https"` // HTTPS配置
|
||||
TCP *TCPProtocolConfig `yaml:"tcp" json:"tcp"` // TCP配置
|
||||
TLS *TLSProtocolConfig `yaml:"tls" json:"tls"` // TLS配置
|
||||
Unix *UnixProtocolConfig `yaml:"unix" json:"unix"` // Unix配置
|
||||
UDP *UDPProtocolConfig `yaml:"udp" json:"udp"` // UDP配置
|
||||
|
||||
// Web配置
|
||||
Web *WebConfig `yaml:"web" json:"web"`
|
||||
|
||||
// 反向代理配置
|
||||
ReverseProxy *ReverseProxyConfig `yaml:"reverseProxy" json:"reverseProxy"`
|
||||
}
|
||||
|
||||
// 从JSON中解析Server配置
|
||||
func NewServerConfigFromJSON(data []byte) (*ServerConfig, error) {
|
||||
config := &ServerConfig{}
|
||||
err := json.Unmarshal(data, config)
|
||||
return config, err
|
||||
}
|
||||
|
||||
func NewServerConfig() *ServerConfig {
|
||||
return &ServerConfig{}
|
||||
}
|
||||
|
||||
func (this *ServerConfig) Init() error {
|
||||
if this.HTTP != nil {
|
||||
err := this.HTTP.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if this.HTTPS != nil {
|
||||
err := this.HTTPS.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if this.TCP != nil {
|
||||
err := this.TCP.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if this.TLS != nil {
|
||||
err := this.TLS.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if this.Unix != nil {
|
||||
err := this.Unix.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if this.UDP != nil {
|
||||
err := this.UDP.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if this.ReverseProxy != nil {
|
||||
err := this.ReverseProxy.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ServerConfig) FullAddresses() []string {
|
||||
result := []Protocol{}
|
||||
if this.HTTP != nil && this.HTTP.IsOn {
|
||||
result = append(result, this.HTTP.FullAddresses()...)
|
||||
}
|
||||
if this.HTTPS != nil && this.HTTPS.IsOn {
|
||||
result = append(result, this.HTTPS.FullAddresses()...)
|
||||
}
|
||||
if this.TCP != nil && this.TCP.IsOn {
|
||||
result = append(result, this.TCP.FullAddresses()...)
|
||||
}
|
||||
if this.TLS != nil && this.TLS.IsOn {
|
||||
result = append(result, this.TLS.FullAddresses()...)
|
||||
}
|
||||
if this.Unix != nil && this.Unix.IsOn {
|
||||
result = append(result, this.Unix.FullAddresses()...)
|
||||
}
|
||||
if this.UDP != nil && this.UDP.IsOn {
|
||||
result = append(result, this.UDP.FullAddresses()...)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (this *ServerConfig) Listen() []*NetworkAddressConfig {
|
||||
result := []*NetworkAddressConfig{}
|
||||
if this.HTTP != nil {
|
||||
result = append(result, this.HTTP.Listen...)
|
||||
}
|
||||
if this.HTTPS != nil {
|
||||
result = append(result, this.HTTPS.Listen...)
|
||||
}
|
||||
if this.TCP != nil {
|
||||
result = append(result, this.TCP.Listen...)
|
||||
}
|
||||
if this.TLS != nil {
|
||||
result = append(result, this.TLS.Listen...)
|
||||
}
|
||||
if this.Unix != nil {
|
||||
result = append(result, this.Unix.Listen...)
|
||||
}
|
||||
if this.UDP != nil {
|
||||
result = append(result, this.UDP.Listen...)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (this *ServerConfig) AsJSON() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
||||
func (this *ServerConfig) IsHTTP() bool {
|
||||
return this.HTTP != nil || this.HTTPS != nil
|
||||
}
|
||||
|
||||
func (this *ServerConfig) IsTCP() bool {
|
||||
return this.TCP != nil || this.TLS != nil
|
||||
}
|
||||
|
||||
func (this *ServerConfig) IsUnix() bool {
|
||||
return this.Unix != nil
|
||||
}
|
||||
|
||||
func (this *ServerConfig) IsUDP() bool {
|
||||
return this.UDP != nil
|
||||
}
|
||||
|
||||
// 判断是否和域名匹配
|
||||
func (this *ServerConfig) MatchName(name string) bool {
|
||||
for _, serverName := range this.ServerNames {
|
||||
if serverName.Match(name) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 判断是否严格匹配
|
||||
func (this *ServerConfig) MatchNameStrictly(name string) bool {
|
||||
for _, serverName := range this.ServerNames {
|
||||
if serverName.Name == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// SSL信息
|
||||
func (this *ServerConfig) SSLConfig() *sslconfigs.SSLConfig {
|
||||
if this.HTTPS != nil {
|
||||
return this.HTTPS.SSL
|
||||
}
|
||||
if this.TLS != nil {
|
||||
return this.TLS.SSL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
74
pkg/serverconfigs/server_config_test.go
Normal file
74
pkg/serverconfigs/server_config_test.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package serverconfigs
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestServerConfig_Protocols(t *testing.T) {
|
||||
{
|
||||
server := NewServerConfig()
|
||||
t.Log(server.FullAddresses())
|
||||
}
|
||||
|
||||
{
|
||||
server := NewServerConfig()
|
||||
server.HTTP = &HTTPProtocolConfig{BaseProtocol: BaseProtocol{
|
||||
IsOn: true,
|
||||
Listen: []*NetworkAddressConfig{
|
||||
{
|
||||
Protocol: ProtocolHTTP,
|
||||
PortRange: "1234",
|
||||
},
|
||||
},
|
||||
}}
|
||||
server.HTTPS = &HTTPSProtocolConfig{BaseProtocol: BaseProtocol{
|
||||
IsOn: true,
|
||||
Listen: []*NetworkAddressConfig{
|
||||
{
|
||||
Protocol: ProtocolUnix,
|
||||
Host: "/hello.sock",
|
||||
PortRange: "1235",
|
||||
},
|
||||
},
|
||||
}}
|
||||
server.TCP = &TCPProtocolConfig{BaseProtocol: BaseProtocol{
|
||||
IsOn: true,
|
||||
Listen: []*NetworkAddressConfig{
|
||||
{
|
||||
Protocol: ProtocolHTTPS,
|
||||
PortRange: "1236",
|
||||
},
|
||||
},
|
||||
}}
|
||||
server.TLS = &TLSProtocolConfig{BaseProtocol: BaseProtocol{
|
||||
IsOn: true,
|
||||
Listen: []*NetworkAddressConfig{
|
||||
{
|
||||
Protocol: ProtocolTCP,
|
||||
PortRange: "1234",
|
||||
},
|
||||
},
|
||||
}}
|
||||
server.Unix = &UnixProtocolConfig{BaseProtocol: BaseProtocol{
|
||||
IsOn: true,
|
||||
Listen: []*NetworkAddressConfig{
|
||||
{
|
||||
Protocol: ProtocolTLS,
|
||||
PortRange: "1234",
|
||||
},
|
||||
},
|
||||
}}
|
||||
server.UDP = &UDPProtocolConfig{BaseProtocol: BaseProtocol{
|
||||
IsOn: true,
|
||||
Listen: []*NetworkAddressConfig{
|
||||
{
|
||||
Protocol: ProtocolUDP,
|
||||
PortRange: "1234",
|
||||
},
|
||||
},
|
||||
}}
|
||||
err := server.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(server.FullAddresses())
|
||||
}
|
||||
}
|
||||
85
pkg/serverconfigs/server_group.go
Normal file
85
pkg/serverconfigs/server_group.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package serverconfigs
|
||||
|
||||
import "strings"
|
||||
|
||||
type ServerGroup struct {
|
||||
fullAddr string
|
||||
Servers []*ServerConfig
|
||||
}
|
||||
|
||||
func NewServerGroup(fullAddr string) *ServerGroup {
|
||||
return &ServerGroup{fullAddr: fullAddr}
|
||||
}
|
||||
|
||||
// 添加服务
|
||||
func (this *ServerGroup) Add(server *ServerConfig) {
|
||||
this.Servers = append(this.Servers, server)
|
||||
}
|
||||
|
||||
// 获取完整的地址
|
||||
func (this *ServerGroup) FullAddr() string {
|
||||
return this.fullAddr
|
||||
}
|
||||
|
||||
// 获取当前分组的协议
|
||||
func (this *ServerGroup) Protocol() Protocol {
|
||||
for _, p := range AllProtocols() {
|
||||
if strings.HasPrefix(this.fullAddr, p+":") {
|
||||
return p
|
||||
}
|
||||
}
|
||||
return ProtocolHTTP
|
||||
}
|
||||
|
||||
// 获取当前分组的地址
|
||||
func (this *ServerGroup) Addr() string {
|
||||
protocol := this.Protocol()
|
||||
if protocol == ProtocolUnix {
|
||||
return strings.TrimPrefix(this.fullAddr, protocol+":")
|
||||
}
|
||||
return strings.TrimPrefix(this.fullAddr, protocol+"://")
|
||||
}
|
||||
|
||||
// 判断当前分组是否为HTTP
|
||||
func (this *ServerGroup) IsHTTP() bool {
|
||||
p := this.Protocol()
|
||||
return p == ProtocolHTTP || p == ProtocolHTTP4 || p == ProtocolHTTP6
|
||||
}
|
||||
|
||||
// 判断当前分组是否为HTTPS
|
||||
func (this *ServerGroup) IsHTTPS() bool {
|
||||
p := this.Protocol()
|
||||
return p == ProtocolHTTPS || p == ProtocolHTTPS4 || p == ProtocolHTTPS6
|
||||
}
|
||||
|
||||
// 判断当前分组是否为TCP
|
||||
func (this *ServerGroup) IsTCP() bool {
|
||||
p := this.Protocol()
|
||||
return p == ProtocolTCP || p == ProtocolTCP4 || p == ProtocolTCP6
|
||||
}
|
||||
|
||||
// 判断当前分组是否为TLS
|
||||
func (this *ServerGroup) IsTLS() bool {
|
||||
p := this.Protocol()
|
||||
return p == ProtocolTLS || p == ProtocolTLS4 || p == ProtocolTLS6
|
||||
}
|
||||
|
||||
// 判断当前分组是否为Unix
|
||||
func (this *ServerGroup) IsUnix() bool {
|
||||
p := this.Protocol()
|
||||
return p == ProtocolUnix
|
||||
}
|
||||
|
||||
// 判断当前分组是否为UDP
|
||||
func (this *ServerGroup) IsUDP() bool {
|
||||
p := this.Protocol()
|
||||
return p == ProtocolUDP
|
||||
}
|
||||
|
||||
// 获取第一个Server
|
||||
func (this *ServerGroup) FirstServer() *ServerConfig {
|
||||
if len(this.Servers) > 0 {
|
||||
return this.Servers[0]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
34
pkg/serverconfigs/server_group_test.go
Normal file
34
pkg/serverconfigs/server_group_test.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestServerGroup_Protocol(t *testing.T) {
|
||||
a := assert.NewAssertion(t)
|
||||
|
||||
{
|
||||
group := NewServerGroup("tcp://127.0.0.1:1234")
|
||||
a.IsTrue(group.Protocol() == ProtocolTCP)
|
||||
a.IsTrue(group.Addr() == "127.0.0.1:1234")
|
||||
}
|
||||
|
||||
{
|
||||
group := NewServerGroup("http4://127.0.0.1:1234")
|
||||
a.IsTrue(group.Protocol() == ProtocolHTTP4)
|
||||
a.IsTrue(group.Addr() == "127.0.0.1:1234")
|
||||
}
|
||||
|
||||
{
|
||||
group := NewServerGroup("127.0.0.1:1234")
|
||||
a.IsTrue(group.Protocol() == ProtocolHTTP)
|
||||
a.IsTrue(group.Addr() == "127.0.0.1:1234")
|
||||
}
|
||||
|
||||
{
|
||||
group := NewServerGroup("unix:/tmp/my.sock")
|
||||
a.IsTrue(group.Protocol() == ProtocolUnix)
|
||||
a.IsTrue(group.Addr() == "/tmp/my.sock")
|
||||
}
|
||||
}
|
||||
23
pkg/serverconfigs/server_name_config.go
Normal file
23
pkg/serverconfigs/server_name_config.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package serverconfigs
|
||||
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/configutils"
|
||||
|
||||
type ServerNameType = string
|
||||
|
||||
const (
|
||||
ServerNameTypeFull = "full" // 完整的域名,包含通配符等
|
||||
ServerNameTypePrefix = "prefix" // 前缀
|
||||
ServerNameTypeSuffix = "suffix" // 后缀
|
||||
ServerNameTypeMatch = "match" // 正则匹配
|
||||
)
|
||||
|
||||
// 主机名(域名)配置
|
||||
type ServerNameConfig struct {
|
||||
Name string `yaml:"name" json:"name"` // 名称
|
||||
Type string `yaml:"type" json:"type"` // 类型
|
||||
}
|
||||
|
||||
// 判断主机名是否匹配
|
||||
func (this *ServerNameConfig) Match(name string) bool {
|
||||
return configutils.MatchDomains([]string{this.Name}, name)
|
||||
}
|
||||
97
pkg/serverconfigs/server_types.go
Normal file
97
pkg/serverconfigs/server_types.go
Normal file
@@ -0,0 +1,97 @@
|
||||
package serverconfigs
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type ServerType = string
|
||||
|
||||
const (
|
||||
ServerTypeHTTPProxy ServerType = "httpProxy"
|
||||
ServerTypeHTTPWeb ServerType = "httpWeb"
|
||||
ServerTypeTCPProxy ServerType = "tcpProxy"
|
||||
ServerTypeUnixProxy ServerType = "unixProxy"
|
||||
ServerTypeUDPProxy ServerType = "udp"
|
||||
)
|
||||
|
||||
// 获取所有的服务类型
|
||||
func AllServerTypes() []maps.Map {
|
||||
return []maps.Map{
|
||||
{
|
||||
"name": "HTTP反向代理",
|
||||
"code": ServerTypeHTTPProxy,
|
||||
},
|
||||
{
|
||||
"name": "HTTP Web服务",
|
||||
"code": ServerTypeHTTPWeb,
|
||||
},
|
||||
{
|
||||
"name": "TCP反向代理",
|
||||
"code": ServerTypeTCPProxy,
|
||||
},
|
||||
/**{
|
||||
"name": "UNIX协议反向代理",
|
||||
"code": ServerTypeUnixProxy,
|
||||
},
|
||||
{
|
||||
"name": "UDP反向代理",
|
||||
"code": ServerTypeUDPProxy,
|
||||
},**/
|
||||
}
|
||||
}
|
||||
|
||||
// 查找服务类型
|
||||
func FindServerType(code string) maps.Map {
|
||||
for _, m := range AllServerTypes() {
|
||||
if m.GetString("code") == code {
|
||||
return m
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取所有协议
|
||||
func AllServerProtocolsForType(serverType ServerType) []maps.Map {
|
||||
protocols := []maps.Map{
|
||||
{
|
||||
"name": "HTTP",
|
||||
"code": "http",
|
||||
"serverTypes": []ServerType{ServerTypeHTTPProxy, ServerTypeHTTPWeb},
|
||||
},
|
||||
{
|
||||
"name": "HTTPS",
|
||||
"code": "https",
|
||||
"serverTypes": []ServerType{ServerTypeHTTPProxy, ServerTypeHTTPWeb},
|
||||
},
|
||||
{
|
||||
"name": "TCP",
|
||||
"code": "tcp",
|
||||
"serverTypes": []ServerType{ServerTypeTCPProxy},
|
||||
},
|
||||
{
|
||||
"name": "TLS",
|
||||
"code": "tls",
|
||||
"serverTypes": []ServerType{ServerTypeTCPProxy},
|
||||
},
|
||||
{
|
||||
"name": "Unix",
|
||||
"code": "unix",
|
||||
"serverTypes": []ServerType{ServerTypeUnixProxy},
|
||||
},
|
||||
{
|
||||
"name": "UDP",
|
||||
"code": "udp",
|
||||
"serverTypes": []ServerType{ServerTypeUDPProxy},
|
||||
},
|
||||
}
|
||||
|
||||
result := []maps.Map{}
|
||||
for _, p := range protocols {
|
||||
serverTypes := p.GetSlice("serverTypes")
|
||||
if lists.Contains(serverTypes, serverType) {
|
||||
result = append(result, p)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
5
pkg/serverconfigs/shared/http_expire_header_config.go
Normal file
5
pkg/serverconfigs/shared/http_expire_header_config.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package shared
|
||||
|
||||
// HTTP Header中Expire设置
|
||||
type HTTPExpireHeaderConfig struct {
|
||||
}
|
||||
57
pkg/serverconfigs/shared/http_header_config.go
Normal file
57
pkg/serverconfigs/shared/http_header_config.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var regexpNamedVariable = regexp.MustCompile("\\${[\\w.-]+}")
|
||||
|
||||
// 头部信息定义
|
||||
type HTTPHeaderConfig struct {
|
||||
Id int `yaml:"id" json:"id"` // ID
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
Name string `yaml:"name" json:"name"` // Name
|
||||
Value string `yaml:"value" json:"value"` // Value
|
||||
Status *HTTPStatusConfig `yaml:"status" json:"status"` // 支持的状态码 TODO
|
||||
|
||||
hasVariables bool
|
||||
}
|
||||
|
||||
// 获取新Header对象
|
||||
func NewHeaderConfig() *HTTPHeaderConfig {
|
||||
return &HTTPHeaderConfig{
|
||||
IsOn: true,
|
||||
}
|
||||
}
|
||||
|
||||
// 校验
|
||||
func (this *HTTPHeaderConfig) Init() error {
|
||||
this.hasVariables = regexpNamedVariable.MatchString(this.Value)
|
||||
|
||||
if this.Status != nil {
|
||||
err := this.Status.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 判断是否匹配状态码
|
||||
func (this *HTTPHeaderConfig) Match(statusCode int) bool {
|
||||
if !this.IsOn {
|
||||
return false
|
||||
}
|
||||
|
||||
if this.Status == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return this.Status.Match(statusCode)
|
||||
}
|
||||
|
||||
// 是否有变量
|
||||
func (this *HTTPHeaderConfig) HasVariables() bool {
|
||||
return this.hasVariables
|
||||
}
|
||||
31
pkg/serverconfigs/shared/http_header_config_test.go
Normal file
31
pkg/serverconfigs/shared/http_header_config_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"github.com/iwind/TeaGo/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHeaderConfig_Match(t *testing.T) {
|
||||
a := assert.NewAssertion(t)
|
||||
h := NewHeaderConfig()
|
||||
err := h.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
a.IsFalse(h.Match(200))
|
||||
a.IsFalse(h.Match(400))
|
||||
|
||||
h.Status = &HTTPStatusConfig{
|
||||
Always: false,
|
||||
Codes: []int{200, 301, 302, 400},
|
||||
}
|
||||
err = h.Init()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
a.IsTrue(h.Match(400))
|
||||
a.IsFalse(h.Match(500))
|
||||
|
||||
h.Status.Always = true
|
||||
a.IsTrue(h.Match(500))
|
||||
}
|
||||
54
pkg/serverconfigs/shared/http_headers_config.go
Normal file
54
pkg/serverconfigs/shared/http_headers_config.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package shared
|
||||
|
||||
// HeaderList定义
|
||||
type HTTPHeadersConfig struct {
|
||||
AddHeaders []*HTTPHeaderConfig `yaml:"addHeaders" json:"addHeaders"` // TODO
|
||||
AddTrailers []*HTTPHeaderConfig `yaml:"addTrailers" json:"addTrailers"` // TODO
|
||||
SetHeaders []*HTTPHeaderConfig `yaml:"setHeaders" json:"setHeaders"` // TODO
|
||||
ReplaceHeaders []*HTTPHeaderConfig `yaml:"replaceHeaders" json:"replaceHeaders"` // TODO
|
||||
|
||||
Expires *HTTPExpireHeaderConfig `yaml:"expires" json:"expires"` // TODO
|
||||
}
|
||||
|
||||
// 获取新对象
|
||||
func NewHTTPHeaders() *HTTPHeadersConfig {
|
||||
return &HTTPHeadersConfig{}
|
||||
}
|
||||
|
||||
// 校验
|
||||
func (this *HTTPHeadersConfig) Init() error {
|
||||
for _, h := range this.AddHeaders {
|
||||
err := h.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, h := range this.AddTrailers {
|
||||
err := h.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, h := range this.SetHeaders {
|
||||
err := h.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, h := range this.ReplaceHeaders {
|
||||
err := h.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 判断是否为空
|
||||
func (this *HTTPHeadersConfig) IsEmpty() bool {
|
||||
return len(this.AddHeaders) == 0 && len(this.AddTrailers) == 0 && len(this.SetHeaders) == 0 && len(this.ReplaceHeaders) == 0 && this.Expires == nil
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user