网络层

This commit is contained in:
2025-06-28 17:38:22 +08:00
parent 54dc7ba173
commit 605197345b
20 changed files with 482 additions and 376 deletions

View File

@@ -1,10 +1,10 @@
package config
type Config struct {
App AppConfig `yaml:"app"`
Log LogConfig `yaml:"log"`
Grpc GrpcConfig `yaml:"grpc"`
DB DBConfig `yaml:"db"`
App *AppConfig `yaml:"app"`
Log *LogConfig `yaml:"log"`
DB *DBConfig `yaml:"db"`
Serve *ServeConfig `yaml:"serve"`
}
type AppConfig struct {
@@ -19,16 +19,25 @@ type LogConfig struct {
Level string `yaml:"level"`
}
type GrpcConfig struct {
Registry *struct {
Address string `yaml:"address"`
Port int `yaml:"port"`
TTL int64 `yaml:"ttl"`
} `yaml:"registry"`
}
type DBConfig struct {
Etcd *struct {
Address []string `yaml:"address"`
} `yaml:"etcd"`
}
type ServeConfig struct {
Grpc *struct {
AddressConfig
TTL int64 `yaml:"ttl"`
} `yaml:"grpc"`
Socket *struct {
Web *AddressConfig `yaml:"web"`
Raw *AddressConfig `yaml:"raw"`
} `yaml:"socket"`
Http *AddressConfig `yaml:"http"`
}
type AddressConfig struct {
Address string `yaml:"address"`
Port int `yaml:"port"`
}