Files
elmprodvpn/selective-vpn-api/app/egress_identity_scope.go

36 lines
961 B
Go

package app
import egressutilpkg "selective-vpn-api/app/egressutil"
func parseEgressScope(raw string) (egressScopeTarget, error) {
target, err := egressutilpkg.ParseScope(raw, sanitizeID)
if err != nil {
return egressScopeTarget{}, err
}
return egressScopeTarget{
Scope: target.Scope,
Source: target.Source,
SourceID: target.SourceID,
}, nil
}
func egressIdentityChanged(prev, next EgressIdentity) bool {
return egressutilpkg.IdentityChanged(
egressIdentitySnapshot(prev),
egressIdentitySnapshot(next),
)
}
func egressIdentitySnapshot(item EgressIdentity) egressutilpkg.IdentitySnapshot {
return egressutilpkg.IdentitySnapshot{
IP: item.IP,
CountryCode: item.CountryCode,
CountryName: item.CountryName,
UpdatedAt: item.UpdatedAt,
Stale: item.Stale,
RefreshInProgress: item.RefreshInProgress,
LastError: item.LastError,
NextRetryAt: item.NextRetryAt,
}
}