2019-05-11 05:48:13 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
import "net"
|
|
|
|
import "os"
|
|
|
|
import "log"
|
|
|
|
import "strconv"
|
|
|
|
|
|
|
|
// import "io"
|
|
|
|
// import "encoding/csv"
|
|
|
|
// import "flag"
|
|
|
|
|
|
|
|
import "github.com/golang/protobuf/proto"
|
2019-05-11 14:59:46 -05:00
|
|
|
import pb "git.wit.com/wit/witProtobuf"
|
2019-05-11 05:48:13 -05:00
|
|
|
|
|
|
|
func main() {
|
2019-05-11 14:59:46 -05:00
|
|
|
msg := pb.CreateSampleEvent()
|
|
|
|
msg.Name = "from dnssecsockettest()"
|
|
|
|
|
2019-05-11 05:48:13 -05:00
|
|
|
data, err := proto.Marshal(msg)
|
|
|
|
if (err != nil) {
|
|
|
|
log.Printf("something fucked up happened")
|
|
|
|
}
|
|
|
|
sendDataToDest(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
func sendDataToDest(data []byte) {
|
|
|
|
conn, err := net.Dial("tcp", "localhost:8080")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
n, err := conn.Write(data)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
fmt.Println("Sent " + strconv.Itoa(n) + " bytes")
|
|
|
|
}
|