mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-24 12:19:07 +00:00
ipn/localapi: plumb an event bus through the localapi.Handler (#16892)
Some of the operations of the local API need an event bus to correctly instantiate other components (notably including the portmapper). This commit adds that, and as the parameter list is starting to get a bit long and hard to read, I took the opportunity to move the arguments to a config type. Only a few call sites needed to be updated and this API is not intended for general use, so I did not bother to stage the change. Updates #15160 Updates #16842 Change-Id: I7b057d71161bd859f5acb96e2f878a34c85be0ef Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
@@ -274,7 +274,13 @@ func (s *Server) Loopback() (addr string, proxyCred, localAPICred string, err er
|
||||
// out the CONNECT code from tailscaled/proxy.go that uses
|
||||
// httputil.ReverseProxy and adding auth support.
|
||||
go func() {
|
||||
lah := localapi.NewHandler(ipnauth.Self, s.lb, s.logf, s.logid)
|
||||
lah := localapi.NewHandler(localapi.HandlerConfig{
|
||||
Actor: ipnauth.Self,
|
||||
Backend: s.lb,
|
||||
Logf: s.logf,
|
||||
LogID: s.logid,
|
||||
EventBus: s.sys.Bus.Get(),
|
||||
})
|
||||
lah.PermitWrite = true
|
||||
lah.PermitRead = true
|
||||
lah.RequiredPassword = s.localAPICred
|
||||
@@ -676,7 +682,13 @@ func (s *Server) start() (reterr error) {
|
||||
go s.printAuthURLLoop()
|
||||
|
||||
// Run the localapi handler, to allow fetching LetsEncrypt certs.
|
||||
lah := localapi.NewHandler(ipnauth.Self, lb, tsLogf, s.logid)
|
||||
lah := localapi.NewHandler(localapi.HandlerConfig{
|
||||
Actor: ipnauth.Self,
|
||||
Backend: lb,
|
||||
Logf: tsLogf,
|
||||
LogID: s.logid,
|
||||
EventBus: sys.Bus.Get(),
|
||||
})
|
||||
lah.PermitWrite = true
|
||||
lah.PermitRead = true
|
||||
|
||||
|
Reference in New Issue
Block a user