Documentation
¶
Index ¶
- func ExtractAndReplaceByComment(nginx string, replace []string, comment ...string) (isReplace bool, newNginx string, err error)
- func ExtractByComment(nginx string, comment ...string) (content []string, err error)
- func ExtractHosts(nginx string) (hosts []string)
- func ExtractLocation(nginx string) (location map[string][]string)
- func ExtractLocationDest(nginx string) (dest string, isroot bool, loc string)
- func ExtractUpstream(nginx string) (upstream []string)
- func ExtractUpstreamValue(upstream string) (server []string, err error)
- func InsertLocation(nginx, location string) string
- func InsertUpstream(nginx, upstream string) string
- func MergeServerF1(nginx1, nginx2 string, nginxs ...string) (nginx string, isMerge bool, err error)
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 ¶
ExtractByComment 提取指定注释间的数据 comment必须成对出现。即 comment-start, comment-end, comment-start, comment-end... 具体使用方式可参考conf_test.go中的实例代码
func ExtractHosts ¶
ExtractHosts 从nginx server片段中抽取domain nginx server片段
func ExtractLocation ¶
ExtractLocation 从nginx server片段中抽取domain和location的映射数据
func ExtractLocationDest ¶
ExtractLocationDest 从location片段中提取root或者proxy_pass地址 通过isroot返回dest类型,同时返回location地址
func ExtractUpstream ¶
ExtractUpstream 从nginx server片段中抽取upstream片段 nginx server片段
func ExtractUpstreamValue ¶
ExtractUpstreamValue 提取Upstream中的ServerName数据
func InsertLocation ¶
InsertLocation 插入一段新的Location片段 此函数不检查是否已经存在相同的Location数据
func InsertUpstream ¶
InsertUpstream 插入一段新的Upstream片段 此函数不检查是否已经存在相同的Upstream数据
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.