mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-01 15:03:30 +03:00
Merge in DNS/adguard-home from AGDNS-2686-client-upstream-manager to master Squashed commit of the following: commit 563cb583f01c26434fa04d0e37dcbe2ba15c0912 Merge:f4b0caf5c
61fe269cb
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Mar 3 19:07:35 2025 +0300 Merge branch 'master' into AGDNS-2686-client-upstream-manager commitf4b0caf5c8
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Feb 27 21:52:51 2025 +0300 client: imp docs commite7d74931b1
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 26 21:44:04 2025 +0300 client: imp code commit1cba38c1bc
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 26 18:06:17 2025 +0300 client: fix typo commit65b6b1e8c0
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 26 17:52:02 2025 +0300 all: imp code, docs commited158ef09f
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 26 14:34:50 2025 +0300 client: imp code commitab897f64c8
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Feb 25 18:26:16 2025 +0300 all: upd chlog commita2c30e3ede
Merge:bdb08ee0e
d8ce5b453
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Feb 25 17:40:32 2025 +0300 Merge branch 'master' into AGDNS-2686-client-upstream-manager commitbdb08ee0e6
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Feb 25 17:16:31 2025 +0300 all: imp tests commit00f0eb6047
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Feb 20 21:37:58 2025 +0300 all: imp code, docs commit1393417663
Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Wed Feb 19 15:58:11 2025 +0300 all: client upstream manager
46 lines
1.5 KiB
Go
46 lines
1.5 KiB
Go
package dnsforward
|
|
|
|
import (
|
|
"net/netip"
|
|
|
|
"github.com/AdguardTeam/AdGuardHome/internal/client"
|
|
"github.com/AdguardTeam/dnsproxy/proxy"
|
|
)
|
|
|
|
// ClientsContainer provides information about preconfigured DNS clients.
|
|
type ClientsContainer interface {
|
|
// CustomUpstreamConfig returns the custom client upstream configuration, if
|
|
// any. It prioritizes ClientID over client IP address to identify the
|
|
// client.
|
|
CustomUpstreamConfig(clientID string, cliAddr netip.Addr) (conf *proxy.CustomUpstreamConfig)
|
|
|
|
// UpdateCommonUpstreamConfig updates the common upstream configuration.
|
|
UpdateCommonUpstreamConfig(conf *client.CommonUpstreamConfig)
|
|
|
|
// ClearUpstreamCache clears the upstream cache for each stored custom
|
|
// client upstream configuration.
|
|
ClearUpstreamCache()
|
|
}
|
|
|
|
// EmptyClientsContainer is an [ClientsContainer] implementation that does nothing.
|
|
type EmptyClientsContainer struct{}
|
|
|
|
// type check
|
|
var _ ClientsContainer = EmptyClientsContainer{}
|
|
|
|
// CustomUpstreamConfig implements the [ClientsContainer] interface for
|
|
// EmptyClientsContainer.
|
|
func (EmptyClientsContainer) CustomUpstreamConfig(
|
|
clientID string,
|
|
cliAddr netip.Addr,
|
|
) (conf *proxy.CustomUpstreamConfig) {
|
|
return nil
|
|
}
|
|
|
|
// UpdateCommonUpstreamConfig implements the [ClientsContainer] interface for
|
|
// EmptyClientsContainer.
|
|
func (EmptyClientsContainer) UpdateCommonUpstreamConfig(conf *client.CommonUpstreamConfig) {}
|
|
|
|
// ClearUpstreamCache implements the [ClientsContainer] interface for
|
|
// EmptyClientsContainer.
|
|
func (EmptyClientsContainer) ClearUpstreamCache() {}
|