example_test.go 801 B

12345678910111213141516171819202122232425262728293031323334
  1. package tip_test
  2. import (
  3. "time"
  4. "go-common/library/ecode/tip"
  5. xhttp "go-common/library/net/http/blademaster"
  6. "go-common/library/net/netutil/breaker"
  7. xtime "go-common/library/time"
  8. )
  9. func ExampleInit() {
  10. conf := &tip.Config{
  11. Domain: "172.16.33.248:6401",
  12. Diff: xtime.Duration(5 * time.Minute),
  13. ClientConfig: &xhttp.ClientConfig{
  14. App: &xhttp.App{
  15. Key: "test",
  16. Secret: "e6c4c252dc7e3d8a90805eecd7c73396",
  17. },
  18. Dial: xtime.Duration(time.Millisecond * 100),
  19. Timeout: xtime.Duration(time.Second * 2),
  20. KeepAlive: xtime.Duration(time.Second * 2),
  21. Breaker: &breaker.Config{
  22. Window: xtime.Duration(time.Millisecond * 10),
  23. Sleep: xtime.Duration(time.Second * 10),
  24. Bucket: 10,
  25. Ratio: 0.5,
  26. Request: 100,
  27. },
  28. },
  29. }
  30. tip.Init(conf)
  31. }