-
Notifications
You must be signed in to change notification settings - Fork 6
/
nacos-istio.go
53 lines (35 loc) · 1.61 KB
/
nacos-istio.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"flag"
"log"
"net/http"
"github.com/nacos-group/nacos-istio/common"
"github.com/nacos-group/nacos-istio/service"
)
var (
nacosServer = flag.String("nacos", "127.0.0.1:8848", "Address of Nacos server")
grpcAddr = flag.String("grpcAddr", ":18848", "Address of the MCP server")
httpAddr = flag.String("httpAddr", ":18849", "Address of the HTTP debug server")
)
func main() {
mocked := flag.Bool("mock", false, "If in mock mode.")
mockServiceCount := flag.Int("mockServiceCount", 0, "service count to test, only used when --mock=true")
mockAvgEndpointCount := flag.Int("mockAvgEndpointCount", 20, "average endpoint count for every service, only used when --mock=true")
mockPushDelay := flag.Int64("mockPushDelay", 10, "push delay in seconds, only used when --mock=true")
mockServiceNamePrefix := flag.String("mockServiceNamePrefix", "mock.service", "mock service name prefix")
mockTestIncremental := flag.Bool("mockTestIncremental", false, "mock service is incremental")
mockIncrementalRatio := flag.Int("mockIncrementalRatio", 0, "ratio of incremental push services")
flag.Parse()
mockParams := &common.MockParams{
Mocked: *mocked,
MockServiceCount: *mockServiceCount,
MockAvgEndpointCount: *mockAvgEndpointCount,
MockPushDelay: *mockPushDelay,
MockServiceNamePrefix: *mockServiceNamePrefix,
MockTestIncremental: *mockTestIncremental,
MockIncrementalRatio: *mockIncrementalRatio,
}
a := service.NewService(*grpcAddr, *mockParams)
log.Println("Starting", a, "mock:", mockParams, "mocked:", *mocked)
_ = http.ListenAndServe(*httpAddr, nil)
}