Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilgooz/sadd
Parse multiple service addresses formatted in a special single string syntax.
https://github.com/ilgooz/sadd
address go golang network service url
Last synced: about 1 month ago
JSON representation
Parse multiple service addresses formatted in a special single string syntax.
- Host: GitHub
- URL: https://github.com/ilgooz/sadd
- Owner: ilgooz
- License: mit
- Created: 2018-06-27T19:40:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-27T20:24:51.000Z (over 6 years ago)
- Last Synced: 2024-06-20T13:55:07.320Z (5 months ago)
- Topics: address, go, golang, network, service, url
- Language: Go
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# sadd [![GoDoc](https://godoc.org/github.com/ilgooz/sadd?status.svg)](https://godoc.org/github.com/ilgooz/sadd) [![Go Report Card](https://goreportcard.com/badge/github.com/ilgooz/sadd)](https://goreportcard.com/report/github.com/ilgooz/sadd) [![Build Status](https://travis-ci.org/ilgooz/sadd.svg?branch=master)](https://travis-ci.org/ilgooz/sadd)
Parse multiple service addresses formatted in a special single string syntax.
```
go get gopkg.in/ilgooz/sadd.v1
```### Example
```go
package mainimport (
"fmt"
"log""github.com/ilgooz/sadd"
)func main() {
query := ":6379,:3000-:3003,localhost:3000-:3003,192.168.1.126:3000-:3003,192.168.1.254:3000-192.168.2.1:3001"
addresses, err := sadd.ParseQuery(query)
if err != nil {
log.Fatal(err)
}
for _, address := range addresses {
fmt.Println(address)
}
// outputs:
// :6379
// :3000
// :3001
// :3002
// :3003
// localhost:3000
// localhost:3001
// localhost:3002
// localhost:3003
// 192.168.1.126:3000
// 192.168.1.126:3001
// 192.168.1.126:3002
// 192.168.1.126:3003
// 192.168.1.254:3000
// 192.168.1.254:3001
// 192.168.1.255:3000
// 192.168.1.255:3001
// 192.168.2.0:3000
// 192.168.2.0:3001
// 192.168.2.1:3000
// 192.168.2.1:3001
}```