znginx

package
v0.0.0-...-473e0bf Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAndReplaceByComment

func ExtractAndReplaceByComment(nginx string, replace []string, comment ...string) (isReplace bool, newNginx string, err error)

ExtractAndReplaceByComment 替换指定注释之间的数据, 仅支持替换一个注释区间的数据 replace 准备替换的文件内容

func ExtractByComment

func ExtractByComment(nginx string, comment ...string) (content []string, err error)

ExtractByComment 提取指定注释间的数据 comment必须成对出现。即 comment-start, comment-end, comment-start, comment-end... 具体使用方式可参考conf_test.go中的实例代码

func ExtractHosts

func ExtractHosts(nginx string) (hosts []string)

ExtractHosts 从nginx server片段中抽取domain nginx server片段

func ExtractLocation

func ExtractLocation(nginx string) (location map[string][]string)

ExtractLocation 从nginx server片段中抽取domain和location的映射数据

func ExtractLocationDest

func ExtractLocationDest(nginx string) (dest string, isroot bool, loc string)

ExtractLocationDest 从location片段中提取root或者proxy_pass地址 通过isroot返回dest类型,同时返回location地址

func ExtractUpstream

func ExtractUpstream(nginx string) (upstream []string)

ExtractUpstream 从nginx server片段中抽取upstream片段 nginx server片段

func ExtractUpstreamValue

func ExtractUpstreamValue(upstream string) (server []string, err error)

ExtractUpstreamValue 提取Upstream中的ServerName数据

func InsertLocation

func InsertLocation(nginx, location string) string

InsertLocation 插入一段新的Location片段 此函数不检查是否已经存在相同的Location数据

func InsertUpstream

func InsertUpstream(nginx, upstream string) string

InsertUpstream 插入一段新的Upstream片段 此函数不检查是否已经存在相同的Upstream数据

func MergeServerF1

func MergeServerF1(nginx1, nginx2 string, nginxs ...string) (nginx string, isMerge bool, err error)

MergeServerF1 标准Server合并模式 每个server片段中server_name 只能是单域名,在多域名情况下使用此函数会导致合并后的业务语义错误 通过isMerge返回是否发生了合并行为

Types

This section is empty.

Jump to

Keyboard shortcuts

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