[#607] network: Generalize LocalAddressSource to address group

Make `LocalAddressSource.LocalAddress` method to return `AddressGroup`. Make
`IsLocalAddress` function to accept parameter of type `AddressGroup`. Adopt
the application code with temporary `GroupFromAddress` helper.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-22 13:25:44 +03:00 committed by Leonard Lyubich
parent e11f50ec8e
commit 6e5d7f84af
7 changed files with 15 additions and 15 deletions

View file

@ -79,7 +79,7 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep
return nil, fmt.Errorf("could not convert address to IP format: %w", err)
}
if network.IsLocalAddress(rtp.localAddrSrc, netAddr) {
if network.IsLocalAddress(rtp.localAddrSrc, network.GroupFromAddress(netAddr)) {
// if local => return no-op writer
return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil
}