Add String method to all interfaces
This commit is contained in:
@@ -308,6 +308,10 @@ func (h *httpTransport) Listen(addr string) (Listener, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *httpTransport) String() string {
|
||||
return "http"
|
||||
}
|
||||
|
||||
func newHttpTransport(addrs []string, opt ...Option) *httpTransport {
|
||||
return &httpTransport{}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ type Listener interface {
|
||||
type Transport interface {
|
||||
Dial(addr string, opts ...DialOption) (Client, error)
|
||||
Listen(addr string) (Listener, error)
|
||||
String() string
|
||||
}
|
||||
|
||||
type options struct{}
|
||||
@@ -59,3 +60,7 @@ func Dial(addr string, opts ...DialOption) (Client, error) {
|
||||
func Listen(addr string) (Listener, error) {
|
||||
return DefaultTransport.Listen(addr)
|
||||
}
|
||||
|
||||
func String() string {
|
||||
return DefaultTransport.String()
|
||||
}
|
||||
|
Reference in New Issue
Block a user