Documentation ¶
Index ¶
- Constants
- Variables
- func ReadConfiguration()
- type GRPCServer
- type HTTPServer
- type HTTPServerOption
- type InfrabinService
- func (s *InfrabinService) AWS(ctx context.Context, request *AWSRequest) (*structpb.Struct, error)
- func (s *InfrabinService) Delay(ctx context.Context, request *DelayRequest) (*Response, error)
- func (s *InfrabinService) Env(ctx context.Context, request *EnvRequest) (*Response, error)
- func (s *InfrabinService) Headers(ctx context.Context, request *HeadersRequest) (*Response, error)
- func (s *InfrabinService) Proxy(ctx context.Context, request *ProxyRequest) (*structpb.Struct, error)
- func (s *InfrabinService) Root(ctx context.Context, _ *Empty) (*Response, error)
Constants ¶
View Source
const ( AppName = "go-infrabin" DefaultHost = "0.0.0.0" DefaultGRPCPort uint = 50051 DefaultHTTPServerPort uint = 8888 DefaultAdminPort uint = 8889 DefaultPrometheusPort uint = 8887 EnableProxyEndpoint = false AWSMetadataEndpoint = "http://169.254.169.254/latest/meta-data/" DrainTimeout = 15 * time.Second MaxDelay = 120 * time.Second HttpWriteTimeout = MaxDelay + time.Second HttpReadTimeout = 60 * time.Second HttpIdleTimeout = 15 * time.Second HttpReadHeaderTimeout = 15 * time.Second DefaultConfigName = "config" DefaultConfigType = "yaml" )
Variables ¶
View Source
var (
DefaultConfigPaths = [...]string{".", "./config", "./cmd/go-infrabin"}
)
Functions ¶
func ReadConfiguration ¶ added in v1.3.0
func ReadConfiguration()
ReadConfiguration : Sets up a default configuration then overwrites any configured details from a config.yaml file in the local directory or under ./config
Types ¶
type GRPCServer ¶
type GRPCServer struct { Name string Server *grpc.Server InfrabinService InfrabinServer HealthService *health.Server }
Server wraps the gRPC server and implements infrabin.Infrabin
func (*GRPCServer) ListenAndServe ¶
func (s *GRPCServer) ListenAndServe(lis net.Listener)
ListenAndServe binds the server to the indicated interface:port. Pass lis as nil to be bound to the config port. lis can be passed for testing
func (*GRPCServer) Shutdown ¶
func (s *GRPCServer) Shutdown()
type HTTPServer ¶
func NewHTTPServer ¶
func NewHTTPServer(name string, opts ...HTTPServerOption) *HTTPServer
func (*HTTPServer) ListenAndServe ¶
func (s *HTTPServer) ListenAndServe()
func (*HTTPServer) Shutdown ¶
func (s *HTTPServer) Shutdown()
type HTTPServerOption ¶ added in v1.3.0
type HTTPServerOption func(ctx context.Context, s *HTTPServer)
func RegisterHandler ¶ added in v1.3.0
func RegisterHandler(pattern string, handler http.Handler) HTTPServerOption
func RegisterHealth ¶ added in v1.3.0
func RegisterHealth(pattern string, healthService *health.Server) HTTPServerOption
func RegisterInfrabin ¶ added in v1.3.0
func RegisterInfrabin(pattern string, infrabinService InfrabinServer) HTTPServerOption
type InfrabinService ¶
type InfrabinService struct {
UnimplementedInfrabinServer
}
Must embed UnimplementedInfrabinServer for `protogen-gen-go-grpc`
func (*InfrabinService) Delay ¶
func (s *InfrabinService) Delay(ctx context.Context, request *DelayRequest) (*Response, error)
func (*InfrabinService) Env ¶
func (s *InfrabinService) Env(ctx context.Context, request *EnvRequest) (*Response, error)
func (*InfrabinService) Headers ¶
func (s *InfrabinService) Headers(ctx context.Context, request *HeadersRequest) (*Response, error)
Click to show internal directories.
Click to hide internal directories.