|
|
@ -85,6 +85,7 @@ type Direct struct {
|
|
|
|
newDecompressor func() (Decompressor, error)
|
|
|
|
newDecompressor func() (Decompressor, error)
|
|
|
|
keepAlive bool
|
|
|
|
keepAlive bool
|
|
|
|
logf logger.Logf
|
|
|
|
logf logger.Logf
|
|
|
|
|
|
|
|
discoPubKey tailcfg.DiscoKey
|
|
|
|
|
|
|
|
|
|
|
|
mu sync.Mutex // mutex guards the following fields
|
|
|
|
mu sync.Mutex // mutex guards the following fields
|
|
|
|
serverKey wgcfg.Key
|
|
|
|
serverKey wgcfg.Key
|
|
|
@ -104,6 +105,7 @@ type Options struct {
|
|
|
|
AuthKey string // optional node auth key for auto registration
|
|
|
|
AuthKey string // optional node auth key for auto registration
|
|
|
|
TimeNow func() time.Time // time.Now implementation used by Client
|
|
|
|
TimeNow func() time.Time // time.Now implementation used by Client
|
|
|
|
Hostinfo *tailcfg.Hostinfo // non-nil passes ownership, nil means to use default using os.Hostname, etc
|
|
|
|
Hostinfo *tailcfg.Hostinfo // non-nil passes ownership, nil means to use default using os.Hostname, etc
|
|
|
|
|
|
|
|
DiscoPublicKey tailcfg.DiscoKey
|
|
|
|
NewDecompressor func() (Decompressor, error)
|
|
|
|
NewDecompressor func() (Decompressor, error)
|
|
|
|
KeepAlive bool
|
|
|
|
KeepAlive bool
|
|
|
|
Logf logger.Logf
|
|
|
|
Logf logger.Logf
|
|
|
@ -153,6 +155,7 @@ func NewDirect(opts Options) (*Direct, error) {
|
|
|
|
keepAlive: opts.KeepAlive,
|
|
|
|
keepAlive: opts.KeepAlive,
|
|
|
|
persist: opts.Persist,
|
|
|
|
persist: opts.Persist,
|
|
|
|
authKey: opts.AuthKey,
|
|
|
|
authKey: opts.AuthKey,
|
|
|
|
|
|
|
|
discoPubKey: opts.DiscoPublicKey,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if opts.Hostinfo == nil {
|
|
|
|
if opts.Hostinfo == nil {
|
|
|
|
c.SetHostinfo(NewHostinfo())
|
|
|
|
c.SetHostinfo(NewHostinfo())
|
|
|
@ -478,6 +481,7 @@ func (c *Direct) PollNetMap(ctx context.Context, maxPolls int, cb func(*NetworkM
|
|
|
|
IncludeIPv6: includeIPv6(),
|
|
|
|
IncludeIPv6: includeIPv6(),
|
|
|
|
KeepAlive: c.keepAlive,
|
|
|
|
KeepAlive: c.keepAlive,
|
|
|
|
NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()),
|
|
|
|
NodeKey: tailcfg.NodeKey(persist.PrivateNodeKey.Public()),
|
|
|
|
|
|
|
|
DiscoKey: c.discoPubKey,
|
|
|
|
Endpoints: ep,
|
|
|
|
Endpoints: ep,
|
|
|
|
Stream: allowStream,
|
|
|
|
Stream: allowStream,
|
|
|
|
Hostinfo: hostinfo,
|
|
|
|
Hostinfo: hostinfo,
|
|
|
|