1234567891011121314151617181920212223242526272829 |
- package main
- import (
- "cfTest/networkdiagnostic"
- pb "cfTest/networkdiagnostic/pb"
- "google.golang.org/grpc"
- "net"
- )
- const (
- networkDiagnosticPort = ":50050"
- )
- func main() {
- networkdiagnostic.Init()
- logger := networkdiagnostic.GetLogger()
- lis, err := net.Listen("tcp", networkDiagnosticPort)
- if err != nil {
- logger.Error("failed to listen: ", err)
- }
- s := grpc.NewServer()
- pb.RegisterNetworkDiagnosticServiceServer(s, &networkdiagnostic.NetworkDiagnosticServer{})
- logger.Println("server listening at ", lis.Addr())
- if err := s.Serve(lis); err != nil {
- logger.Error("failed to serve: ", err)
- }
- }
|