Skip to content

Instantly share code, notes, and snippets.

@matipan
Created November 6, 2017 19:51
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 matipan/814e96bdd0a174cbef3b95d4e6729068 to your computer and use it in GitHub Desktop.
Save matipan/814e96bdd0a174cbef3b95d4e6729068 to your computer and use it in GitHub Desktop.
package main
import (
"context"
"fmt"
"net"
"os"
"github.com/matipan/qsy"
)
func main() {
group := net.IPv4(224, 0, 0, 12)
srv, err := qsy.NewServer(context.TODO(), "en0", group, os.Getenv("MY_IP"))
if err != nil {
panic(err)
}
srv.ListenAndAccept()
for {
select {
case pkt := <-srv.Incoming():
fmt.Printf("got packet from %v\n", pkt.ID)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment