components

package
v1.10.1-lts Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultServer = "default_server"

Variables

This section is empty.

Functions

func IsRepeatKey

func IsRepeatKey(key string) bool

Types

type Block

type Block struct {
	Line        int
	Comment     string
	Directives  []IDirective
	IsLuaBlock  bool
	LiteralCode string
}

func (*Block) FindDirectives

func (b *Block) FindDirectives(directiveName string) []IDirective

func (*Block) GetCodeBlock

func (b *Block) GetCodeBlock() string

func (*Block) GetComment

func (b *Block) GetComment() string

func (*Block) GetDirectives

func (b *Block) GetDirectives() []IDirective

func (*Block) GetLine

func (b *Block) GetLine() int

func (*Block) RemoveDirective

func (b *Block) RemoveDirective(key string, params []string)

func (*Block) UpdateDirective

func (b *Block) UpdateDirective(key string, params []string)

type Comment

type Comment struct {
	Detail string
	Line   int
}

func (*Comment) GetBlock

func (c *Comment) GetBlock() IBlock

func (*Comment) GetComment

func (c *Comment) GetComment() string

func (*Comment) GetLine

func (c *Comment) GetLine() int

func (*Comment) GetName

func (c *Comment) GetName() string

func (*Comment) GetParameters

func (c *Comment) GetParameters() []string

type Config

type Config struct {
	*Block
	FilePath string
}

func (*Config) FindHttp

func (c *Config) FindHttp() *Http

func (*Config) FindServers

func (c *Config) FindServers() []*Server

type Directive

type Directive struct {
	Line       int
	Block      IBlock
	Name       string
	Comment    string
	Parameters []string
}

func (*Directive) GetBlock

func (d *Directive) GetBlock() IBlock

func (*Directive) GetComment

func (d *Directive) GetComment() string

func (*Directive) GetLine

func (d *Directive) GetLine() int

func (*Directive) GetName

func (d *Directive) GetName() string

func (*Directive) GetParameters

func (d *Directive) GetParameters() []string

type Http

type Http struct {
	Comment    string
	Servers    []*Server
	Directives []IDirective
	Line       int
}

func NewHttp

func NewHttp(directive IDirective) (*Http, error)

func (*Http) FindDirectives

func (h *Http) FindDirectives(directiveName string) []IDirective

func (*Http) GetBlock

func (h *Http) GetBlock() IBlock

func (*Http) GetCodeBlock

func (h *Http) GetCodeBlock() string

func (*Http) GetComment

func (h *Http) GetComment() string

func (*Http) GetDirectives

func (h *Http) GetDirectives() []IDirective

func (*Http) GetLine

func (h *Http) GetLine() int

func (*Http) GetName

func (h *Http) GetName() string

func (*Http) GetParameters

func (h *Http) GetParameters() []string

func (*Http) RemoveDirective

func (h *Http) RemoveDirective(key string, params []string)

func (*Http) UpdateDirective

func (h *Http) UpdateDirective(key string, params []string)

type IBlock

type IBlock interface {
	GetDirectives() []IDirective
	FindDirectives(directiveName string) []IDirective
	RemoveDirective(name string, params []string)
	UpdateDirective(name string, params []string)
	GetComment() string
	GetLine() int
	GetCodeBlock() string
}

type IDirective

type IDirective interface {
	GetName() string
	GetParameters() []string
	GetBlock() IBlock
	GetComment() string
	GetLine() int
}

type Location

type Location struct {
	Modifier   string
	Match      string
	Cache      bool
	ProxyPass  string
	Host       string
	CacheTime  int
	CacheUint  string
	Comment    string
	Directives []IDirective
	Line       int
	Parameters []string
	Replaces   map[string]string
}

func NewLocation

func NewLocation(directive IDirective) *Location

func (*Location) AddCache added in v1.2.0

func (l *Location) AddCache(cacheTime int, cacheUint string)

func (*Location) AddSubFilter added in v1.2.0

func (l *Location) AddSubFilter(subFilters map[string]string)

func (*Location) ChangePath added in v1.2.0

func (l *Location) ChangePath(Modifier string, Match string)

func (*Location) FindDirectives added in v1.2.0

func (l *Location) FindDirectives(directiveName string) []IDirective

func (*Location) GetBlock added in v1.2.0

func (l *Location) GetBlock() IBlock

func (*Location) GetCodeBlock

func (l *Location) GetCodeBlock() string

func (*Location) GetComment added in v1.2.0

func (l *Location) GetComment() string

func (*Location) GetDirectives added in v1.2.0

func (l *Location) GetDirectives() []IDirective

func (*Location) GetLine added in v1.2.0

func (l *Location) GetLine() int

func (*Location) GetName added in v1.2.0

func (l *Location) GetName() string

func (*Location) GetParameters added in v1.2.0

func (l *Location) GetParameters() []string

func (*Location) RemoveCache added in v1.2.0

func (l *Location) RemoveCache()

func (*Location) RemoveDirective added in v1.2.0

func (l *Location) RemoveDirective(key string, params []string)

func (*Location) RemoveSubFilter added in v1.2.0

func (l *Location) RemoveSubFilter()

func (*Location) UpdateDirective added in v1.2.0

func (l *Location) UpdateDirective(key string, params []string)

type LuaBlock

type LuaBlock struct {
	Directives []IDirective
	Name       string
	Comment    string
	LuaCode    string
	Line       int
}

func NewLuaBlock

func NewLuaBlock(directive IDirective) (*LuaBlock, error)

func (*LuaBlock) FindDirectives

func (lb *LuaBlock) FindDirectives(directiveName string) []IDirective

func (*LuaBlock) GetBlock

func (lb *LuaBlock) GetBlock() IBlock

func (*LuaBlock) GetCodeBlock

func (lb *LuaBlock) GetCodeBlock() string

func (*LuaBlock) GetComment

func (lb *LuaBlock) GetComment() string

func (*LuaBlock) GetDirectives

func (lb *LuaBlock) GetDirectives() []IDirective

func (*LuaBlock) GetLine

func (lb *LuaBlock) GetLine() int

func (*LuaBlock) GetName

func (lb *LuaBlock) GetName() string

func (*LuaBlock) GetParameters

func (lb *LuaBlock) GetParameters() []string

func (*LuaBlock) RemoveDirective

func (lb *LuaBlock) RemoveDirective(key string, params []string)

func (*LuaBlock) UpdateDirective

func (lb *LuaBlock) UpdateDirective(key string, params []string)

type Server

type Server struct {
	Comment    string
	Listens    []*ServerListen
	Directives []IDirective
	Line       int
}

func NewServer

func NewServer(directive IDirective) (*Server, error)

func (*Server) AddHTTP2HTTPS

func (s *Server) AddHTTP2HTTPS()

func (*Server) AddListen

func (s *Server) AddListen(bind string, defaultServer bool, params ...string)

func (*Server) AddServerName

func (s *Server) AddServerName(name string)

func (*Server) DeleteListen

func (s *Server) DeleteListen(bind string)

func (*Server) DeleteServerName

func (s *Server) DeleteServerName(name string)

func (*Server) FindDirectives

func (s *Server) FindDirectives(directiveName string) []IDirective

func (*Server) GetBlock

func (s *Server) GetBlock() IBlock

func (*Server) GetCodeBlock

func (s *Server) GetCodeBlock() string

func (*Server) GetComment

func (s *Server) GetComment() string

func (*Server) GetDirectives

func (s *Server) GetDirectives() []IDirective

func (*Server) GetLine

func (s *Server) GetLine() int

func (*Server) GetName

func (s *Server) GetName() string

func (*Server) GetParameters

func (s *Server) GetParameters() []string

func (*Server) RemoveDirective

func (s *Server) RemoveDirective(key string, params []string)

func (*Server) RemoveListenByBind

func (s *Server) RemoveListenByBind(bind string)

func (*Server) UpdateDirective

func (s *Server) UpdateDirective(key string, params []string)

func (*Server) UpdateDirectiveBySecondKey

func (s *Server) UpdateDirectiveBySecondKey(name string, key string, directive Directive)

func (*Server) UpdateListen

func (s *Server) UpdateListen(bind string, defaultServer bool, params ...string)

func (*Server) UpdatePHPProxy added in v1.1.0

func (s *Server) UpdatePHPProxy(proxy []string, localPath string)

func (*Server) UpdateRoot

func (s *Server) UpdateRoot(path string)

func (*Server) UpdateRootLocation

func (s *Server) UpdateRootLocation()

func (*Server) UpdateRootProxy

func (s *Server) UpdateRootProxy(proxy []string)

func (*Server) UpdateServerName

func (s *Server) UpdateServerName(names []string)

type ServerListen

type ServerListen struct {
	Bind          string
	DefaultServer string
	Parameters    []string
	Comment       string
	Line          int
}

func NewServerListen

func NewServerListen(params []string, line int) *ServerListen

func (*ServerListen) AddDefaultServer

func (sl *ServerListen) AddDefaultServer()

func (*ServerListen) GetBlock

func (sl *ServerListen) GetBlock() IBlock

func (*ServerListen) GetComment

func (sl *ServerListen) GetComment() string

func (*ServerListen) GetLine

func (sl *ServerListen) GetLine() int

func (*ServerListen) GetName

func (sl *ServerListen) GetName() string

func (*ServerListen) GetParameters

func (sl *ServerListen) GetParameters() []string

func (*ServerListen) RemoveDefaultServe

func (sl *ServerListen) RemoveDefaultServe()

type Upstream

type Upstream struct {
	UpstreamName    string
	UpstreamServers []*UpstreamServer
	Directives      []IDirective
	Comment         string
	Line            int
}

func NewUpstream

func NewUpstream(directive IDirective) (*Upstream, error)

func (*Upstream) AddServer

func (us *Upstream) AddServer(server *UpstreamServer)

func (*Upstream) FindDirectives

func (us *Upstream) FindDirectives(directiveName string) []IDirective

func (*Upstream) GetBlock

func (us *Upstream) GetBlock() IBlock

func (*Upstream) GetCodeBlock

func (us *Upstream) GetCodeBlock() string

func (*Upstream) GetComment

func (us *Upstream) GetComment() string

func (*Upstream) GetDirectives

func (us *Upstream) GetDirectives() []IDirective

func (*Upstream) GetLine

func (us *Upstream) GetLine() int

func (*Upstream) GetName

func (us *Upstream) GetName() string

func (*Upstream) GetParameters

func (us *Upstream) GetParameters() []string

func (*Upstream) RemoveDirective

func (us *Upstream) RemoveDirective(key string, params []string)

func (*Upstream) UpdateDirective

func (us *Upstream) UpdateDirective(key string, params []string)

type UpstreamServer

type UpstreamServer struct {
	Comment    string
	Address    string
	Flags      []string
	Parameters map[string]string
	Line       int
}

func NewUpstreamServer

func NewUpstreamServer(directive IDirective) *UpstreamServer

func (*UpstreamServer) GetBlock

func (uss *UpstreamServer) GetBlock() IBlock

func (*UpstreamServer) GetComment

func (uss *UpstreamServer) GetComment() string

func (*UpstreamServer) GetDirective

func (uss *UpstreamServer) GetDirective() *Directive

func (*UpstreamServer) GetLine

func (uss *UpstreamServer) GetLine() int

func (*UpstreamServer) GetName

func (uss *UpstreamServer) GetName() string

func (*UpstreamServer) GetParameters

func (uss *UpstreamServer) GetParameters() []string

Jump to

Keyboard shortcuts

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