mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Make some API changes (currently broken)
This commit is contained in:
parent
a2966291b9
commit
37533f157d
4 changed files with 84 additions and 81 deletions
|
@ -2,9 +2,13 @@ package util
|
|||
|
||||
// These are misc. utility functions that didn't really fit anywhere else
|
||||
|
||||
import "runtime"
|
||||
import "sync"
|
||||
import "time"
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A wrapper around runtime.Gosched() so it doesn't need to be imported elsewhere.
|
||||
func Yield() {
|
||||
|
@ -91,3 +95,16 @@ func Difference(a, b []string) []string {
|
|||
}
|
||||
return ab
|
||||
}
|
||||
|
||||
// DecodeCoordString decodes a string representing coordinates in [1 2 3] format
|
||||
// and returns a []byte.
|
||||
func DecodeCoordString(in string) (out []uint64) {
|
||||
s := strings.Trim(in, "[]")
|
||||
t := strings.Split(s, " ")
|
||||
for _, a := range t {
|
||||
if u, err := strconv.ParseUint(a, 0, 64); err == nil {
|
||||
out = append(out, u)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue