location
This commit is contained in:
@@ -51,6 +51,23 @@ type BehaviorWarning struct {
|
|||||||
Evidence string `json:"evidence,omitempty" bson:"evidence,omitempty"`
|
Evidence string `json:"evidence,omitempty" bson:"evidence,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PeerLocation holds the voluntarily disclosed geographic position of a node.
|
||||||
|
// Granularity controls how precise the location is:
|
||||||
|
//
|
||||||
|
// 0 = not disclosed
|
||||||
|
// 1 = continent (±15°)
|
||||||
|
// 2 = country (±3°) — default
|
||||||
|
// 3 = region (±0.5°)
|
||||||
|
// 4 = city (±0.05°)
|
||||||
|
//
|
||||||
|
// The coordinates are always fuzzed by oc-discovery before publication,
|
||||||
|
// so a granularity-2 location identifies only the rough country area.
|
||||||
|
type PeerLocation struct {
|
||||||
|
Latitude float64 `json:"latitude" bson:"latitude"`
|
||||||
|
Longitude float64 `json:"longitude" bson:"longitude"`
|
||||||
|
Granularity int `json:"granularity" bson:"granularity"`
|
||||||
|
}
|
||||||
|
|
||||||
// Peer is a struct that represents a peer
|
// Peer is a struct that represents a peer
|
||||||
type Peer struct {
|
type Peer struct {
|
||||||
utils.AbstractObject
|
utils.AbstractObject
|
||||||
@@ -68,6 +85,9 @@ type Peer struct {
|
|||||||
ServicesState map[string]int `json:"services_state,omitempty" bson:"services_state,omitempty"`
|
ServicesState map[string]int `json:"services_state,omitempty" bson:"services_state,omitempty"`
|
||||||
FailedExecution []PeerExecution `json:"failed_execution" bson:"failed_execution"` // FailedExecution is the list of failed executions, to be retried
|
FailedExecution []PeerExecution `json:"failed_execution" bson:"failed_execution"` // FailedExecution is the list of failed executions, to be retried
|
||||||
|
|
||||||
|
// Location is the voluntarily disclosed (and fuzzed) geographic position.
|
||||||
|
Location *PeerLocation `json:"location,omitempty" bson:"location,omitempty"`
|
||||||
|
|
||||||
// Trust scoring — maintained by oc-discovery from PEER_BEHAVIOR_EVENT reports.
|
// Trust scoring — maintained by oc-discovery from PEER_BEHAVIOR_EVENT reports.
|
||||||
TrustScore float64 `json:"trust_score" bson:"trust_score" default:"100"`
|
TrustScore float64 `json:"trust_score" bson:"trust_score" default:"100"`
|
||||||
BlacklistReason string `json:"blacklist_reason,omitempty" bson:"blacklist_reason,omitempty"`
|
BlacklistReason string `json:"blacklist_reason,omitempty" bson:"blacklist_reason,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user