From 630b9f87b841ec5b41d4ddfc5a4cb713f6a0167d Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Thu, 6 Dec 2018 20:07:52 +0800 Subject: [PATCH] fix test --- chain.go | 5 ++++- node.go | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chain.go b/chain.go index 362d285..ab39560 100644 --- a/chain.go +++ b/chain.go @@ -256,7 +256,10 @@ func (c *Chain) selectRoute() (route *Chain, err error) { // selectRouteFor selects route with bypass testing. func (c *Chain) selectRouteFor(addr string) (route *Chain, err error) { - if c.IsEmpty() || c.isRoute { + if c.IsEmpty() { + return newRoute(), nil + } + if c.isRoute { return c, nil } diff --git a/node.go b/node.go index b412623..282a027 100644 --- a/node.go +++ b/node.go @@ -2,6 +2,7 @@ package gost import ( "errors" + "fmt" "net/url" "strconv" "strings" @@ -140,6 +141,10 @@ func (node *Node) GetInt(key string) int { } func (node Node) String() string { + if node.url == nil { + return fmt.Sprintf("%s+%s://%s", + node.Protocol, node.Transport, node.Addr) + } return node.url.String() }