add grpc server support
This commit is contained in:
30
providers/grpcs/config.go
Normal file
30
providers/grpcs/config.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package grpcs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const DefaultPrefix = "Grpc"
|
||||
|
||||
type Config struct {
|
||||
Host *string
|
||||
Port uint
|
||||
Tls *Tls
|
||||
}
|
||||
|
||||
type Tls struct {
|
||||
CA string
|
||||
Cert string
|
||||
Key string
|
||||
}
|
||||
|
||||
func (h *Config) Address() string {
|
||||
if h.Host == nil {
|
||||
return h.PortString()
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", *h.Host, h.Port)
|
||||
}
|
||||
|
||||
func (h *Config) PortString() string {
|
||||
return fmt.Sprintf(":%d", h.Port)
|
||||
}
|
||||
Reference in New Issue
Block a user