(args *cli.Context)
| 114 | } |
| 115 | |
| 116 | func runGate(args *cli.Context) error { |
| 117 | listen := args.String("listen") |
| 118 | if listen == "" { |
| 119 | return errors.Errorf("gate listen address cannot empty") |
| 120 | } |
| 121 | |
| 122 | masterAddr := args.String("master") |
| 123 | if masterAddr == "" { |
| 124 | return errors.Errorf("master address cannot empty") |
| 125 | } |
| 126 | |
| 127 | gateAddr := args.String("gate-address") |
| 128 | if gateAddr == "" { |
| 129 | return errors.Errorf("gate address cannot empty") |
| 130 | } |
| 131 | |
| 132 | log.Println("Current server listen address", listen) |
| 133 | log.Println("Current gate server address", gateAddr) |
| 134 | log.Println("Remote master server address", masterAddr) |
| 135 | |
| 136 | // Startup Nano server with the specified listen address |
| 137 | nano.Listen(listen, |
| 138 | nano.WithAdvertiseAddr(masterAddr), |
| 139 | nano.WithClientAddr(gateAddr), |
| 140 | nano.WithComponents(onegate.Services), |
| 141 | nano.WithSerializer(json.NewSerializer()), |
| 142 | nano.WithIsWebsocket(true), |
| 143 | nano.WithWSPath("/nano"), |
| 144 | nano.WithCheckOriginFunc(func(_ *http.Request) bool { return true }), |
| 145 | nano.WithDebugMode(), |
| 146 | //set remote service route for gate |
| 147 | nano.WithCustomerRemoteServiceRoute(customerRemoteServiceRoute), |
| 148 | nano.WithNodeId(2), // if you deploy multi gate, option set nodeId, default nodeId = os.Getpid() |
| 149 | ) |
| 150 | return nil |
| 151 | } |
| 152 | |
| 153 | func runChat(args *cli.Context) error { |
| 154 | listen := args.String("listen") |
nothing calls this directly
no test coverage detected
searching dependent graphs…