Debian Codegraph @

infra/conf/api.go

raw symbols SCIP
1 package confscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/
2
3 import (
4 "stringsscip-go gomod github.com/golang/go/src go1.15 strings/"
5
6 "v2ray.com/core/app/commanderscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/"
7 loggerservicescip-go gomod v2ray.com/core . `v2ray.com/core/app/log/command`/ "v2ray.com/core/app/log/commandscip-go gomod v2ray.com/core . `v2ray.com/core/app/log/command`/"
8 handlerservicescip-go gomod v2ray.com/core . `v2ray.com/core/app/proxyman/command`/ "v2ray.com/core/app/proxyman/commandscip-go gomod v2ray.com/core . `v2ray.com/core/app/proxyman/command`/"
9 statsservicescip-go gomod v2ray.com/core . `v2ray.com/core/app/stats/command`/ "v2ray.com/core/app/stats/commandscip-go gomod v2ray.com/core . `v2ray.com/core/app/stats/command`/"
10 "v2ray.com/core/common/serialscip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/"
11 )
12
13 type APIConfigscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig# struct {
14 Tagscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#Tag. string `json:"tag"`
15 Servicesscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#Services. []string `json:"services"`
16 }
17
18 func (c *APIConfigscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#) Buildscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#Build().() (*commanderscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/.Configscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/Config#, error) {
19 if c.Tagscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#Tag. == "" {
20 return nil, newErrorscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/newError().("API tag can't be empty.")
21 }
22
23 services := make([]*serialscip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/.TypedMessagescip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/TypedMessage#, 0, 16)
24 for _, s := range c.Servicesscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#Services. {
25 switch stringsscip-go gomod github.com/golang/go/src go1.15 strings/.ToLowerscip-go gomod github.com/golang/go/src go1.15 strings/ToLower().(s) {
26 case "reflectionservice":
27 services = append(services, serialscip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/.ToTypedMessagescip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/ToTypedMessage().(&commanderscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/.ReflectionConfigscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/ReflectionConfig#{}))
28 case "handlerservice":
29 services = append(services, serialscip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/.ToTypedMessagescip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/ToTypedMessage().(&handlerservicescip-go gomod v2ray.com/core . `v2ray.com/core/app/proxyman/command`/.Configscip-go gomod v2ray.com/core . `v2ray.com/core/app/proxyman/command`/Config#{}))
30 case "loggerservice":
31 services = append(services, serialscip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/.ToTypedMessagescip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/ToTypedMessage().(&loggerservicescip-go gomod v2ray.com/core . `v2ray.com/core/app/log/command`/.Configscip-go gomod v2ray.com/core . `v2ray.com/core/app/log/command`/Config#{}))
32 case "statsservice":
33 services = append(services, serialscip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/.ToTypedMessagescip-go gomod v2ray.com/core . `v2ray.com/core/common/serial`/ToTypedMessage().(&statsservicescip-go gomod v2ray.com/core . `v2ray.com/core/app/stats/command`/.Configscip-go gomod v2ray.com/core . `v2ray.com/core/app/stats/command`/Config#{}))
34 }
35 }
36
37 return &commanderscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/.Configscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/Config#{
38 Tagscip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/Config#Tag.: c.Tagscip-go gomod v2ray.com/core . `v2ray.com/core/infra/conf`/APIConfig#Tag.,
39 Servicescip-go gomod v2ray.com/core . `v2ray.com/core/app/commander`/Config#Service.: services,
40 }, nil
41 }