components

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: GPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
}

func (*Block) FindDirectives

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

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) FindDirectives

func (c *Config) FindDirectives(directiveName string) []IDirective

func (*Config) FindHttp

func (c *Config) FindHttp() *Http

func (*Config) FindServers

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

func (*Config) FindUpstreams

func (c *Config) FindUpstreams() []*Upstream

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) 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
}

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

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

func (*Location) AddSubFilter

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

func (*Location) ChangePath

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

func (*Location) FindDirectives

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

func (*Location) GetBlock

func (l *Location) GetBlock() IBlock

func (*Location) GetComment

func (l *Location) GetComment() string

func (*Location) GetDirectives

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

func (*Location) GetLine

func (l *Location) GetLine() int

func (*Location) GetName

func (l *Location) GetName() string

func (*Location) GetParameters

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

func (*Location) RemoveCache

func (l *Location) RemoveCache()

func (*Location) RemoveDirective

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

func (*Location) RemoveSubFilter

func (l *Location) RemoveSubFilter()

func (*Location) UpdateDirective

func (l *Location) 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) 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

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) 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