From f2a577f98cc9503c875e99241620167626597a5f Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 13 Apr 2017 12:43:39 +0900 Subject: [PATCH] first commit --- .gitignore | 23 +++++++++++++++++++++++ collector.go | 41 +++++++++++++++++++++++++++++++++++++++++ collector_test.go | 12 ++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .gitignore create mode 100644 collector.go create mode 100644 collector_test.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23b08ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Created by .ignore support plugin (hsz.mobi) +### Go template +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +.gitignore 제거할 예정 +.idea/ 제거할 예정 +collector.go 제거할 예정 + +.idea/ +*.iml \ No newline at end of file diff --git a/collector.go b/collector.go new file mode 100644 index 0000000..5f4a6d0 --- /dev/null +++ b/collector.go @@ -0,0 +1,41 @@ +package collector_go + +import ( + g "loafle.com/overflow/crawler_go/grpc" + "google.golang.org/grpc" + "log" + "context" + +) + + +const ( + address = "192.168.1.105:50052" +) + +func CallGet() { + + conn, err := grpc.Dial(address, grpc.WithInsecure()) + if err != nil { + log.Fatalf("did not connect: %v", err) + } + defer conn.Close() + + + dc := g.NewDataClient(conn); + + in := &g.Input{} + + in.Id = "" + in.Name = g.Crawlers_HEALTH_DNS + + + + out, err := dc.Get(context.Background(), in) + + if err != nil { + log.Println(err) + } + log.Println(out) + +} \ No newline at end of file diff --git a/collector_test.go b/collector_test.go new file mode 100644 index 0000000..0939aa2 --- /dev/null +++ b/collector_test.go @@ -0,0 +1,12 @@ +package collector_go + +import "testing" + +func TestCallGet(t *testing.T) { + + CallGet() + + + + +} \ No newline at end of file