appc: factor app connector arguments into a Config type (#17389)

Replace the positional arguments to NewAppConnector with a Config struct.
Update the existing uses. Other than the API change, there are no functional
changes in this commit.

Updates #15160
Updates #17192

Change-Id: Ibf37f021372155a4db8aaf738f4b4f2c746bf623
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
M. J. Fromberger
2025-10-01 11:39:01 -07:00
committed by GitHub
parent 05a4c8e839
commit 6f7ce5eb5d
5 changed files with 133 additions and 38 deletions
+11 -4
View File
@@ -2309,9 +2309,11 @@ func TestOfferingAppConnector(t *testing.T) {
t.Fatal("unexpected offering app connector")
}
if shouldStore {
b.appConnector = appc.NewAppConnector(t.Logf, nil, &appc.RouteInfo{}, fakeStoreRoutes)
b.appConnector = appc.NewAppConnector(appc.Config{
Logf: t.Logf, RouteInfo: &appc.RouteInfo{}, StoreRoutesFunc: fakeStoreRoutes,
})
} else {
b.appConnector = appc.NewAppConnector(t.Logf, nil, nil, nil)
b.appConnector = appc.NewAppConnector(appc.Config{Logf: t.Logf})
}
if !b.OfferingAppConnector() {
t.Fatal("unexpected not offering app connector")
@@ -2370,9 +2372,14 @@ func TestObserveDNSResponse(t *testing.T) {
rc := &appctest.RouteCollector{}
if shouldStore {
b.appConnector = appc.NewAppConnector(t.Logf, rc, &appc.RouteInfo{}, fakeStoreRoutes)
b.appConnector = appc.NewAppConnector(appc.Config{
Logf: t.Logf,
RouteAdvertiser: rc,
RouteInfo: &appc.RouteInfo{},
StoreRoutesFunc: fakeStoreRoutes,
})
} else {
b.appConnector = appc.NewAppConnector(t.Logf, rc, nil, nil)
b.appConnector = appc.NewAppConnector(appc.Config{Logf: t.Logf, RouteAdvertiser: rc})
}
b.appConnector.UpdateDomains([]string{"example.com"})
b.appConnector.Wait(context.Background())