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