nginx

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DirectiveInclude is the include directive.
	DirectiveInclude = "include"
	// DirectiveHTTP is the http directive.
	DirectiveHTTP = "http"
	// DirectiveServer is the server directive.
	DirectiveServer = "server"
	// DirectiveLocation is the location directive.
	DirectiveLocation = "location"
)

Variables

This section is empty.

Functions

func Cmd

func Cmd() *cobra.Command

Cmd returns convert nginx.conf command.

Types

type BackendInfo

type BackendInfo struct {
	Server string `json:"server"`
	Weight int    `json:"weight"`
}

BackendInfo is the config for backend.

type Config

type Config struct {
	Servers []*Server `json:"servers"`
}

Config is config for convert.

type Directive

type Directive = crossplane.Directive

Directive is the nginx directive.

type Directives

type Directives = crossplane.Directives

Directives is the nginx directives.

type Env

type Env struct {
	Server   *ServerEnv   `json:"server"`
	Proxy    *ProxyEnv    `json:"proxy"`
	Upstream []*Directive `json:"upstream"`
	// contains filtered or unexported fields
}

Env is the environment for converting. Server is the server environment. Used to create HTTPServer or in future GRPCServer. Proxy is the proxy environment. Used to create Pipeline.

func (*Env) Clone

func (env *Env) Clone() (*Env, error)

Clone clones the environment.

func (*Env) GetProxyInfo

func (env *Env) GetProxyInfo() (*ProxyInfo, error)

GetProxyInfo gets the proxy info from environment.

func (*Env) GetServerInfo

func (env *Env) GetServerInfo() (*ServerInfo, error)

GetServerInfo gets the server info from environment.

func (*Env) MustClone

func (env *Env) MustClone() *Env

MustClone clones the environment.

func (*Env) Update

func (env *Env) Update(d *Directive)

Update updates the environment.

type GzipEnv

type GzipEnv struct {
	Gzip          *Directive `json:"gzip"`
	GzipMinLength *Directive `json:"gzip_min_length"`
}

GzipEnv is the environment for creating gzip.

type HostInfo

type HostInfo struct {
	Value    string `json:"value"`
	IsRegexp bool   `json:"isRegexp"`
}

HostInfo is the info config for host.

type Options

type Options struct {
	NginxConf      string
	Output         string
	ResourcePrefix string
	// contains filtered or unexported fields
}

Options contains the options for convert nginx.conf.

func (*Options) GetPipelineName

func (opt *Options) GetPipelineName(path string) string

GetPipelineName creates a globally unique name for the pipeline based on the path.

type Path

type Path struct {
	Path    string     `json:"path"`
	Type    PathType   `json:"type"`
	Backend *ProxyInfo `json:"backend"`
}

Path is the config for path.

type PathType

type PathType string

PathType is the type of path.

const (
	// PathTypePrefix is the prefix type of path.
	PathTypePrefix PathType = "prefix"
	// PathTypeExact is the exact type of path.
	PathTypeExact PathType = "exact"
	// PathTypeRe is the regexp type of path.
	PathTypeRe PathType = "regexp"
	// PathTypeReInsensitive is the case insensitive regexp type of path.
	PathTypeReInsensitive PathType = "caseInsensitiveRegexp"
)

type Payload

type Payload = crossplane.Payload

Payload is the nginx payload.

type ProxyEnv

type ProxyEnv struct {
	Pass           *Directive   `json:"pass"`
	ProxySetHeader []*Directive `json:"proxy_set_header"`
	Gzip           *GzipEnv     `json:"gzip"`
}

ProxyEnv is the environment for creating proxy.

type ProxyInfo

type ProxyInfo struct {
	Servers       []*BackendInfo    `json:"servers"`
	SetHeaders    map[string]string `json:"setHeaders"`
	GzipMinLength int               `json:"gzipMinLength"`
}

ProxyInfo is the config for proxy.

type Rule

type Rule struct {
	Hosts []*HostInfo `json:"hosts"`
	Paths []*Path     `json:"paths"`
}

Rule is the config for rule.

type Server

type Server struct {
	ServerBase `json:",inline"`
	Rules      []*Rule `json:"rules"`
}

Server is the config for server.

type ServerBase

type ServerBase struct {
	Port    int    `json:"port"`
	Address string `json:"address"`
	HTTPS   bool   `json:"https"`

	CaCert string            `json:"caCert"`
	Certs  map[string]string `json:"certs"`
	Keys   map[string]string `json:"keys"`
}

ServerBase is the base config for server.

type ServerEnv

type ServerEnv struct {
	Listen               *Directive   `json:"listen"`
	ServerName           *Directive   `json:"server_name"`
	SSLClientCertificate *Directive   `json:"ssl_client_certificate"`
	SSLCertificate       []*Directive `json:"ssl_certificate"`
	SSLCertificateKey    []*Directive `json:"ssl_certificate_key"`
}

ServerEnv is the environment for creating server. Listen contains the listen address, port and protocol. ServerName contains the server name (hosts in easegress).

type ServerInfo

type ServerInfo struct {
	ServerBase `json:",inline"`
	Hosts      []*HostInfo `json:"hosts"`
}

ServerInfo is the info config for server.

Jump to

Keyboard shortcuts

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