Skip to content

Instantly share code, notes, and snippets.

@jpfuentes2
Created February 5, 2014 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpfuentes2/8825534 to your computer and use it in GitHub Desktop.
Save jpfuentes2/8825534 to your computer and use it in GitHub Desktop.
Barebones Riemann server for integration tests
package main
import (
pb "code.google.com/p/goprotobuf/proto"
msg "github.com/amir/raidman/proto"
"log"
"net"
)
func createRiemannServer() {
addr, _ := net.ResolveUDPAddr("udp", "localhost:5555")
server, _ := net.ListenUDP("udp", addr)
for {
buf := make([]byte, 1024)
rlen, _, err := server.ReadFromUDP(buf)
if err != nil {
log.Fatal(err.Error())
}
msg := &msg.Msg{}
pb.Unmarshal(buf[:rlen], msg)
log.Print(msg.Events[0])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment