Complete subnet immune autopsy UI and prefix normalization.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Normalize /24 labels for autopsy API and cred-graph triggers; add Emberwake/Path Tracer autopsy cards and Vitest coverage for Seer feed consumers.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package atlas
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"crypto-miner-server/internal/db"
|
||||
@@ -22,7 +23,18 @@ func NewSubnetImmune(database *db.Database) *SubnetImmune {
|
||||
|
||||
// PrefixFromHostOrIP normalizes a host IP or subnet label to a /24 prefix key.
|
||||
func PrefixFromHostOrIP(hostOrSubnet string) string {
|
||||
return SubnetPrefix(hostOrSubnet)
|
||||
s := strings.TrimSpace(hostOrSubnet)
|
||||
s = strings.TrimSuffix(s, ".x")
|
||||
s = strings.TrimSuffix(s, ".0/24")
|
||||
s = strings.TrimSuffix(s, "/24")
|
||||
if prefix := SubnetPrefix(s); prefix != "" {
|
||||
return prefix
|
||||
}
|
||||
parts := strings.Split(s, ".")
|
||||
if len(parts) >= 3 && parts[0] != "" && parts[1] != "" && parts[2] != "" {
|
||||
return strings.Join(parts[:3], ".")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// RecordSpreadFailure increments subnet failure count; returns true when pause activates.
|
||||
|
||||
Reference in New Issue
Block a user