Curl.go 539 B

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