platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
35
selective-vpn-api/app/egress_identity_scope.go
Normal file
35
selective-vpn-api/app/egress_identity_scope.go
Normal file
@@ -0,0 +1,35 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user