本文整理汇总了Golang中github.com/cloudfoundry/gorouter/registry.RouteRegistry类的典型用法代码示例。如果您正苦于以下问题:Golang RouteRegistry类的具体用法?Golang RouteRegistry怎么用?Golang RouteRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RouteRegistry类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: registerAddr
func registerAddr(reg *registry.RouteRegistry, path string, routeServiceUrl string, addr net.Addr, instanceId string) {
host, portStr, err := net.SplitHostPort(addr.String())
Expect(err).NotTo(HaveOccurred())
port, err := strconv.Atoi(portStr)
Expect(err).NotTo(HaveOccurred())
reg.Register(route.Uri(path), route.NewEndpoint("", host, uint16(port), instanceId, nil, -1, routeServiceUrl))
}
开发者ID:sunatthegilddotcom,项目名称:gorouter,代码行数:9,代码来源:proxy_test.go
示例2: registerAddr
func registerAddr(r *registry.RouteRegistry, u string, a net.Addr, instanceId string) {
h, p, err := net.SplitHostPort(a.String())
Ω(err).NotTo(HaveOccurred())
x, err := strconv.Atoi(p)
Ω(err).NotTo(HaveOccurred())
r.Register(route.Uri(u), route.NewEndpoint("", h, uint16(x), instanceId, nil))
}
开发者ID:tomzhang,项目名称:golang-devops-stuff,代码行数:9,代码来源:proxy_test.go
示例3: waitMsgReceived
func waitMsgReceived(registry *registry.RouteRegistry, app *test.TestApp, expectedToBeFound bool, timeout time.Duration) bool {
interval := time.Millisecond * 50
repetitions := int(timeout / interval)
for j := 0; j < repetitions; j++ {
if j > 0 {
time.Sleep(interval)
}
received := true
for _, url := range app.Urls() {
pool := registry.Lookup(url)
if expectedToBeFound && pool == nil {
received = false
break
} else if !expectedToBeFound && pool != nil {
received = false
break
}
}
if received {
return true
}
}
return false
}
开发者ID:tomzhang,项目名称:golang-devops-stuff,代码行数:27,代码来源:helper_test.go
示例4: appUnregistered
func appUnregistered(registry *registry.RouteRegistry, app *common.TestApp) bool {
for _, url := range app.Urls() {
pool := registry.Lookup(url)
if pool != nil {
return false
}
}
return true
}
开发者ID:rakutentech,项目名称:gorouter,代码行数:10,代码来源:helper_test.go
示例5:
fakelogger "github.com/cloudfoundry/gorouter/access_log/fakes"
"github.com/cloudfoundry/gorouter/metrics/fakes"
"github.com/cloudfoundry/gorouter/proxy"
"github.com/cloudfoundry/gorouter/registry"
"github.com/cloudfoundry/gorouter/route"
"github.com/cloudfoundry/gorouter/test_util"
"github.com/cloudfoundry/yagnats/fakeyagnats"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Proxy Unit tests", func() {
var (
proxyObj proxy.Proxy
fakeAccessLogger *fakelogger.FakeAccessLogger
r *registry.RouteRegistry
)
Context("ServeHTTP", func() {
BeforeEach(func() {
tlsConfig := &tls.Config{
CipherSuites: conf.CipherSuites,
InsecureSkipVerify: conf.SSLSkipValidation,
}
fakeAccessLogger = &fakelogger.FakeAccessLogger{}
mbus := fakeyagnats.Connect()
r = registry.NewRouteRegistry(conf, mbus, new(fakes.FakeRouteReporter))
开发者ID:idouba,项目名称:gorouter,代码行数:30,代码来源:proxy_unit_test.go
示例6:
. "github.com/cloudfoundry/gorouter/varz"
"github.com/cloudfoundry/yagnats/fakeyagnats"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/pivotal-golang/lager"
"github.com/pivotal-golang/lager/lagertest"
"encoding/json"
"fmt"
"net/http"
"time"
)
var _ = Describe("Varz", func() {
var Varz Varz
var Registry *registry.RouteRegistry
var logger lager.Logger
BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
Registry = registry.NewRouteRegistry(logger, config.DefaultConfig(), fakeyagnats.Connect(), new(fakes.FakeRouteRegistryReporter))
Varz = NewVarz(Registry)
})
It("contains the following items", func() {
v := Varz
members := []string{
"responses_2xx",
"responses_3xx",
"responses_4xx",
开发者ID:sunatthegilddotcom,项目名称:gorouter,代码行数:31,代码来源:varz_test.go
示例7:
testcommon "github.com/cloudfoundry/gorouter/test/common"
"github.com/pivotal-golang/lager"
"github.com/pivotal-golang/lager/lagertest"
)
var _ = Describe("Router", func() {
const uuid_regex = `^[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}$`
var (
natsRunner *test_util.NATSRunner
natsPort uint16
config *cfg.Config
mbusClient *nats.Conn
registry *rregistry.RouteRegistry
varz vvarz.Varz
router *Router
signals chan os.Signal
closeChannel chan struct{}
readyChan chan struct{}
logger lager.Logger
)
BeforeEach(func() {
natsPort = test_util.NextAvailPort()
natsRunner = test_util.NewNATSRunner(int(natsPort))
natsRunner.Start()
fakeEmitter := fake.NewFakeEventEmitter("fake")
dropsonde.InitializeWithEmitter(fakeEmitter)
开发者ID:rakutentech,项目名称:gorouter,代码行数:31,代码来源:router_test.go
注:本文中的github.com/cloudfoundry/gorouter/registry.RouteRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论