Documentation ¶
Index ¶
- type Authorization
- type Balancer
- type BasicAuthMethod
- type CircuitBreaker
- type CommonBalancer
- type Correlation
- type FileSystem
- func (fs *FileSystem) ClearDir(dir string) error
- func (fs *FileSystem) DeleteDir(dir string) error
- func (fs *FileSystem) DeleteFile(path string) error
- func (fs *FileSystem) DirExists(path string) bool
- func (fs *FileSystem) EnsureDir(dirName string, mode int) error
- func (fs *FileSystem) EnsureTrailingSlash(dir string) string
- func (fs *FileSystem) FileExists(path string) bool
- func (fs *FileSystem) GetHostname() (string, error)
- func (fs *FileSystem) PathExists(path string) bool
- func (fs *FileSystem) ReadFile(path string) (string, error)
- func (fs *FileSystem) RemoveStartingSlash(dir string) string
- func (fs *FileSystem) RemoveTrailingSlash(dir string) string
- func (fs *FileSystem) StoreFile(path, content string) error
- type Item
- type KeyBasedAuthMethod
- type OAuthAuthMethod
- type Proxy
- type RandomBalancer
- type RateLimiter
- type Records
- type RoundRobinBalancer
- type Router
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balancer ¶
Balancer interface
func NewRandomBalancer ¶
NewRandomBalancer returns a random proxy balancer.
func NewRoundRobinBalancer ¶
NewRoundRobinBalancer returns a round-robin proxy balancer.
type BasicAuthMethod ¶
BasicAuthMethod type
func (*BasicAuthMethod) Authenticate ¶
func (b *BasicAuthMethod) Authenticate(endpoint model.Endpoint, authKey string) (model.BasicAuthData, error)
Authenticate validates auth headers
type CircuitBreaker ¶
CircuitBreaker struct
func NewCircuitBreaker ¶
func NewCircuitBreaker(redisDriver *service.Redis, hashMap string) *CircuitBreaker
NewCircuitBreaker gets a new instance
type CommonBalancer ¶
type CommonBalancer struct {
// contains filtered or unexported fields
}
CommonBalancer type
func (*CommonBalancer) AddTarget ¶
func (b *CommonBalancer) AddTarget(target *Target) bool
AddTarget adds an upstream target to the list.
func (*CommonBalancer) RemoveTarget ¶
func (b *CommonBalancer) RemoveTarget(url string) bool
RemoveTarget removes an upstream target from the list.
type FileSystem ¶
type FileSystem struct { }
FileSystem struct
func (*FileSystem) ClearDir ¶
func (fs *FileSystem) ClearDir(dir string) error
ClearDir removes all files and sub dirs
func (*FileSystem) DeleteDir ¶
func (fs *FileSystem) DeleteDir(dir string) error
DeleteDir deletes a dir
func (*FileSystem) DeleteFile ¶
func (fs *FileSystem) DeleteFile(path string) error
DeleteFile deletes a file
func (*FileSystem) DirExists ¶
func (fs *FileSystem) DirExists(path string) bool
DirExists reports whether the dir exists
func (*FileSystem) EnsureDir ¶
func (fs *FileSystem) EnsureDir(dirName string, mode int) error
EnsureDir ensures that directory exists
func (*FileSystem) EnsureTrailingSlash ¶
func (fs *FileSystem) EnsureTrailingSlash(dir string) string
EnsureTrailingSlash ensure there is a trailing slash
func (*FileSystem) FileExists ¶
func (fs *FileSystem) FileExists(path string) bool
FileExists reports whether the named file exists
func (*FileSystem) GetHostname ¶
func (fs *FileSystem) GetHostname() (string, error)
GetHostname gets the hostname
func (*FileSystem) PathExists ¶
func (fs *FileSystem) PathExists(path string) bool
PathExists reports whether the path exists
func (*FileSystem) ReadFile ¶
func (fs *FileSystem) ReadFile(path string) (string, error)
ReadFile get the file content
func (*FileSystem) RemoveStartingSlash ¶
func (fs *FileSystem) RemoveStartingSlash(dir string) string
RemoveStartingSlash removes any starting slash
func (*FileSystem) RemoveTrailingSlash ¶
func (fs *FileSystem) RemoveTrailingSlash(dir string) string
RemoveTrailingSlash removes any trailing slash
func (*FileSystem) StoreFile ¶
func (fs *FileSystem) StoreFile(path, content string) error
StoreFile stores a file content
type KeyBasedAuthMethod ¶
KeyBasedAuthMethod type
func (*KeyBasedAuthMethod) Authenticate ¶
func (k *KeyBasedAuthMethod) Authenticate(endpoint model.Endpoint, apiKey string) (model.KeyBasedAuthData, error)
Authenticate validates auth headers
type OAuthAuthMethod ¶
OAuthAuthMethod type
func (*OAuthAuthMethod) Authenticate ¶
func (o *OAuthAuthMethod) Authenticate(endpoint model.Endpoint, accessToken string) (model.OAuthData, error)
Authenticate validates auth headers
func (*OAuthAuthMethod) ValidateClientCredentials ¶
func (o *OAuthAuthMethod) ValidateClientCredentials(authorizationToken string) (model.OAuthData, error)
ValidateClientCredentials validates client credentials
type Proxy ¶
type Proxy struct { Name string Upstream string Meta map[string]string RequestMeta []string RequestID string HTTPRequest *http.Request HTTPWriter http.ResponseWriter }
Proxy type
func NewProxy ¶
func NewProxy( httpRequest *http.Request, httpWriter http.ResponseWriter, name, upstream, meta string, requestMeta []string, requestID string, ) *Proxy
NewProxy creates a new instance
func (*Proxy) ConvertMetaData ¶
ConvertMetaData converts meta data format into map meta in the form of key1:value1;key2:value2 ---> map{"key1": "value1", "key2": "value2"}
type RandomBalancer ¶
type RandomBalancer struct { *CommonBalancer // contains filtered or unexported fields }
RandomBalancer implements a random load balancing technique.
func (*RandomBalancer) Next ¶
func (b *RandomBalancer) Next() *Target
Next randomly returns an upstream target.
type RateLimiter ¶
RateLimiter struct
func NewRateLimiter ¶
func NewRateLimiter(redisDriver *service.Redis, hashMap string) *RateLimiter
NewRateLimiter gets a new instance
type Records ¶
type Records struct {
Items []Item
}
Records struct
func (*Records) ConvertToJSON ¶
ConvertToJSON convert object to json
func (*Records) LoadFromJSON ¶
LoadFromJSON update object from json
type RoundRobinBalancer ¶
type RoundRobinBalancer struct { *CommonBalancer // contains filtered or unexported fields }
RoundRobinBalancer implements a round-robin load balancing technique.
func (*RoundRobinBalancer) Next ¶
func (b *RoundRobinBalancer) Next() *Target
Next returns an upstream target using round-robin technique.
type Router ¶
type Router struct { }
Router type
func (*Router) BuildRemote ¶
BuildRemote gets the final remote service URL to call