Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Wing924/hostutils
A golang library for packing and unpacking hosts list
https://github.com/Wing924/hostutils
go golang golang-package utility
Last synced: about 1 month ago
JSON representation
A golang library for packing and unpacking hosts list
- Host: GitHub
- URL: https://github.com/Wing924/hostutils
- Owner: Wing924
- License: apache-2.0
- Created: 2017-09-26T03:47:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-18T05:35:02.000Z (about 1 year ago)
- Last Synced: 2024-01-31T05:16:05.204Z (4 months ago)
- Topics: go, golang, golang-package, utility
- Language: Go
- Size: 33.2 KB
- Stars: 12
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Lists
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-extra - hostutils - 09-26T03:47:32Z|2022-01-24T01:07:28Z| (Microsoft Office / Uncategorized)
- awesome-go-zh - hostutils
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - | - | - | (Miscellaneous / Strings)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-projects - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Advanced Console UIs)
- awesome-go-with-framework - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Strings)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-cn - hostutils
- zero-alloc-awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Strings)
- awesome-go. - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Advanced Console UIs)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (<span id="其他-miscellaneous">其他 Miscellaneous</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go-with-stars - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- repo-1316-awesome-go-cn - hostutils
- repo-1211-awesome-go-cn - hostutils
- awesome-Char - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-reader - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Strings)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Strings)
- Go-awesome - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-cn - hostutils
- awesome-go-handwritten - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Advanced Console UIs)
- awesome-go2 - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Advanced Console UIs)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. - :arrow_down:0 - :star:3 (Miscellaneous / Strings)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-stars - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-cn - hostutils
- awesome-go-zh - hostutils
- awesome-go-cn - hostutils
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go - hostutils - A golang library for packing and unpacking FQDNs list. (Miscellaneous / Uncategorized)
- awesome-go-cn - hostutils
- awesome-go - hostutils - A golang library for packing and unpacking hosts list - ★ 5 (Miscellaneous)
- go-awesome-cn-star - hostutils
README
# hostutils
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Go Report Card](https://goreportcard.com/badge/github.com/Wing924/hostutils/v2)](https://goreportcard.com/report/github.com/Wing924/hostutils/v2)
[![codecov](https://codecov.io/gh/Wing924/hostutils/branch/master/graph/badge.svg)](https://codecov.io/gh/Wing924/hostutils)
[![GoDoc](https://godoc.org/github.com/Wing924/hostutils/v2?status.svg)](https://pkg.go.dev/github.com/Wing924/hostutils/v2)A golang library for packing and unpacking hosts list
## Install
```bash
go get github.com/Wing924/hostutils/v2
```## Examples
```go
package mainimport (
"fmt""github.com/Wing924/hostutils/v2"
)func main() {
// Pack
pack1 := hostutils.Pack([]string{"example101z.com", "example102z.com", "example103z.com"})
fmt.Println(pack1) // [example[101-103]z.com]pack2 := hostutils.Pack([]string{"example101z.com", "example102z.com", "example201z.com"})
fmt.Println(pack2) // [example[101-102,201]z.com]pack3 := hostutils.Pack([]string{"example01z.com example02z.com"})
fmt.Println(pack3) // [example[01-02]z.com]// Unpack
unpack1 := hostutils.Unpack([]string{"example[101-103]z.com"})
fmt.Println(unpack1) // [example101z.com example102z.com example103z.com]unpack2 := hostutils.Unpack([]string{"example[1-2][101-102]z.com"})
fmt.Println(unpack2) // [example1101z.com example1102z.com example2101z.com example2102z.com]
}
```## Functions
```
func Normalize(hosts []string) (packedHosts []string)
Normalize Unpack and pack hostsfunc NormalizeString(hosts string) (packedHosts []string)
NormalizeString Unpack and pack hostsfunc Pack(hosts []string) (packedHosts []string)
Pack Pack full hosts list into short abbreviated hosts.func PackString(hosts string) (packedHosts []string)
PackString Pack space septated full hosts list into short abbreviated
hosts.func Unpack(packedHosts []string) (hosts []string)
Unpack Unpack short abbreviated hosts into full hosts list.func UnpackString(packedHosts string) (hosts []string)
Unpack Unpack space septated short abbreviated hosts into full hosts
list.
```