@@ -8,26 +8,27 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Services []*Service `json:"services,omitempty" yaml:"services,omitempty"`
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Addr string `json:"addr,omitempty" yaml:"addr,omitempty"`
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
Reflection bool `json:"reflection,omitempty" yaml:"reflection,omitempty"`
|
||||
Protoset string `json:"protoset,omitempty" yaml:"protoset,omitempty"`
|
||||
Checks []*Check `json:"checks,omitempty" yaml:"checks,omitempty"`
|
||||
TLSVerify *bool `json:"tls_verify,omitempty" yaml:"tls_verify,omitempty"`
|
||||
Checks []*Check `json:"checks,omitempty" yaml:"checks,omitempty"`
|
||||
}
|
||||
|
||||
type Check struct {
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Data string `json:"data,omitempty" yaml:"data,omitempty"`
|
||||
Tasks []*Task `json:"tasks,omitempty" yaml:"tasks,omitempty"`
|
||||
Timeout mtime.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
|
||||
Interval mtime.Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
|
||||
}
|
||||
|
||||
type Task struct {
|
||||
TLSVerify *bool `json:"tls_verify,omitempty" yaml:"tls_verify,omitempty"`
|
||||
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
||||
Name string `json:"name,omitempty" yaml:"name,omitempty"`
|
||||
Data string `json:"data,omitempty" yaml:"data,omitempty"`
|
||||
Addr string `json:"addr,omitempty" yaml:"addr,omitempty"`
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
Protoset string `json:"protoset,omitempty" yaml:"protoset,omitempty"`
|
||||
Timeout mtime.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
|
||||
}
|
||||
|
||||
func (cfg *Config) Parse(r io.Reader) error {
|
||||
buf, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
|
@@ -2,6 +2,7 @@ package grpcconn
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@@ -28,3 +29,9 @@ func Call(ctx context.Context, l logger.Logger, c client.Client, addr string, td
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ServiceMethod(method string) (string, string, string) {
|
||||
idx1 := strings.LastIndex(method, ".")
|
||||
idx2 := strings.Index(method[:idx1], ".")
|
||||
return method[:idx2], method[idx2+1 : idx1], method[idx1+1:]
|
||||
}
|
||||
|
Reference in New Issue
Block a user