service

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Type string `config:"type"`

	// type: basic
	Username string `config:"username"`
	Password string `config:"password"`

	// type: bearer
	Token string `config:"token"`

	// type: jwt
	Secret string `config:"secret"`

	// type: oauth2
	Provider     string   `config:"provider"`
	ClientID     string   `config:"client_id"`
	ClientSecret string   `config:"client_secret"`
	RedirectURL  string   `config:"redirect_url"`
	Scopes       []string `config:"scopes"`
}

type HealthCheck

type HealthCheck struct {
	Enable bool `config:"enable"`

	//
	Method string  `config:"method,default=GET"`
	Path   string  `config:"path,default=/health"`
	Status []int64 `config:"status,default=[200]"`

	// ok means health check is ok, ignore real check
	Ok bool `config:"ok"`
}

type Request

type Request struct {
	Path    RequestPath       `config:"path"`
	Headers map[string]string `config:"headers"`
	Query   map[string]string `config:"query"`
}

type RequestPath

type RequestPath struct {
	DisablePrefixRewrite bool     `config:"disable_prefix_rewrite"`
	Rewrites             []string `config:"rewrites"`
}

type Response

type Response struct {
	Headers map[string]string `config:"headers"`
}

type Service

type Service struct {
	Name     string `config:"name"`
	Port     int64  `config:"port"`
	Protocol string `config:"protocol,default=http"`
	//
	Request  Request  `config:"request"`
	Response Response `config:"response"`
	//
	Auth Auth `config:"auth"`
	//
	HealthCheck HealthCheck `config:"health_check"`
}

func (*Service) CheckDNS added in v1.2.0

func (s *Service) CheckDNS() (ips []string, err error)

func (*Service) Host

func (s *Service) Host() string

func (*Service) Rewrite

func (s *Service) Rewrite(originPath string) (newPath string)

func (*Service) Target

func (s *Service) Target() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL