curl.go 467 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "cfTest/curl"
  4. "cfTest/server"
  5. "google.golang.org/grpc"
  6. "log"
  7. "net"
  8. )
  9. const (
  10. curlPort = ":50053"
  11. )
  12. func main() {
  13. lis, err := net.Listen("tcp", curlPort)
  14. if err != nil {
  15. log.Fatalf("failed to listen: %v", err)
  16. }
  17. s := grpc.NewServer()
  18. curl.RegisterCurlWithResolveServer(s, &server.CurlServer{})
  19. log.Printf("server listening at %v", lis.Addr())
  20. if err := s.Serve(lis); err != nil {
  21. log.Fatalf("failed to serve: %v", err)
  22. }
  23. }