mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
Add tunnel address
This commit is contained in:
parent
86f0c06fac
commit
c2d85a6e1f
@ -521,6 +521,17 @@ func (t *tun) close() error {
|
||||
return t.listener.Close()
|
||||
}
|
||||
|
||||
func (t *tun) Address() string {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
|
||||
if !t.connected {
|
||||
return t.options.Address
|
||||
}
|
||||
|
||||
return t.listener.Addr()
|
||||
}
|
||||
|
||||
// Close the tunnel
|
||||
func (t *tun) Close() error {
|
||||
t.Lock()
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
var (
|
||||
// DefaultAddress is default tunnel bind address
|
||||
DefaultAddress = ":9096"
|
||||
DefaultAddress = ":0"
|
||||
)
|
||||
|
||||
type Option func(*Options)
|
||||
|
@ -11,6 +11,8 @@ import (
|
||||
// the address being requested.
|
||||
type Tunnel interface {
|
||||
Init(opts ...Option) error
|
||||
// Address the tunnel is listening on
|
||||
Address() string
|
||||
// Connect connects the tunnel
|
||||
Connect() error
|
||||
// Close closes the tunnel
|
||||
|
Loading…
Reference in New Issue
Block a user