initial import

This commit is contained in:
kevin
2020-07-26 17:09:05 +08:00
commit 7e3a369a8f
647 changed files with 54754 additions and 0 deletions

27
example/etcd/pub/pub.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import (
"flag"
"fmt"
"log"
"time"
"zero/core/discov"
)
var value = flag.String("v", "value", "the value")
func main() {
flag.Parse()
client := discov.NewPublisher([]string{"etcd.discovery:2379"}, "028F2C35852D", *value)
if err := client.KeepAlive(); err != nil {
log.Fatal(err)
}
defer client.Stop()
for {
time.Sleep(time.Second)
fmt.Println(*value)
}
}