Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // IPv4Regexp IPv4正则表达式 IPv4Regexp = regexp.MustCompile(`(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)){3}`) // IPv6Regexp IPv6正则表达式 // [fF][eE]80:(:[0-9a-fA-F]{1,4}){0,4}(%\w+)?| # IPv6 Link-local // ([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}| # IPv6 // ::([fF]{4}){1}:(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)){3}| # IPv4-mapped IPv6 address // (([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4})?::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4})? # IPv6 with two colons IPv6Regexp = regexp.MustCompile(`[fF][eE]80:(:[0-9a-fA-F]{1,4}){0,4}(%\w+)?|([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::([fF]{4}){1}:(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)){3}|(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4})?::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4})?`) )
Functions ¶
This section is empty.
Types ¶
type SorterSegment ¶
type SorterSegment []Segment
SorterSegment 用于对 Segment 进行排序,按照 Start 字段进行排序
func (SorterSegment) Len ¶
func (s SorterSegment) Len() int
func (SorterSegment) Less ¶
func (s SorterSegment) Less(i, j int) bool
func (SorterSegment) Swap ¶
func (s SorterSegment) Swap(i, j int)
type TextParser ¶
type TextParser struct { Text string IPv4Fields []string IPv4FillResult func(str string) []string IPv6Fields []string IPv6FillResult func(str string) []string // contains filtered or unexported fields }
TextParser 文本解析器
func (*TextParser) Json ¶ added in v0.1.4
func (p *TextParser) Json(indent bool) string
Json 返回解析后的Json
func (*TextParser) ParseIPv4 ¶
func (p *TextParser) ParseIPv4() *TextParser
ParseIPv4 解析文本中的 IPv4 片段
func (*TextParser) ParseIPv6 ¶
func (p *TextParser) ParseIPv6() *TextParser
ParseIPv6 解析文本中的 IPv6 片段
Click to show internal directories.
Click to hide internal directories.