diff --git a/cmd/skywire-cli/commands/visor/pk.go b/cmd/skywire-cli/commands/visor/pk.go
index 71fe62ff1..fef9f2139 100644
--- a/cmd/skywire-cli/commands/visor/pk.go
+++ b/cmd/skywire-cli/commands/visor/pk.go
@@ -16,11 +16,11 @@ var pkCmd = &cobra.Command{
Run: func(_ *cobra.Command, _ []string) {
client := rpcClient()
- summary, err := client.Summary()
+ overview, err := client.Overview()
if err != nil {
logger.Fatal("Failed to connect:", err)
}
- fmt.Println(summary.PubKey)
+ fmt.Println(overview.PubKey)
},
}
diff --git a/cmd/skywire-cli/commands/visor/version.go b/cmd/skywire-cli/commands/visor/version.go
index 9c305543d..b8c905fe6 100644
--- a/cmd/skywire-cli/commands/visor/version.go
+++ b/cmd/skywire-cli/commands/visor/version.go
@@ -16,12 +16,12 @@ var buildInfoCmd = &cobra.Command{
Short: "Obtains version and build info of the node",
Run: func(_ *cobra.Command, _ []string) {
client := rpcClient()
- summary, err := client.Summary()
+ overview, err := client.Overview()
if err != nil {
log.Fatal("Failed to connect:", err)
}
- if _, err := summary.BuildInfo.WriteTo(os.Stdout); err != nil {
+ if _, err := overview.BuildInfo.WriteTo(os.Stdout); err != nil {
log.Fatal("Failed to output build info:", err)
}
},
diff --git a/pkg/visor/api.go b/pkg/visor/api.go
index cbe28e8cf..2b57afda0 100644
--- a/pkg/visor/api.go
+++ b/pkg/visor/api.go
@@ -27,8 +27,8 @@ import (
// API represents visor API.
type API interface {
+ Overview() (*Overview, error)
Summary() (*Summary, error)
- ExtraSummary() (*ExtraSummary, error)
Health() (*HealthInfo, error)
Uptime() (float64, error)
@@ -78,8 +78,8 @@ type HealthCheckable interface {
Health(ctx context.Context) (int, error)
}
-// Summary provides a summary of a Skywire Visor.
-type Summary struct {
+// Overview provides a range of basic information about a Visor.
+type Overview struct {
PubKey cipher.PubKey `json:"local_pk"`
BuildInfo *buildinfo.Info `json:"build_info"`
AppProtoVersion string `json:"app_protocol_version"`
@@ -89,9 +89,9 @@ type Summary struct {
LocalIP string `json:"local_ip"`
}
-// Summary implements API.
-func (v *Visor) Summary() (*Summary, error) {
- var summaries []*TransportSummary
+// Overview implements API.
+func (v *Visor) Overview() (*Overview, error) {
+ var tSummaries []*TransportSummary
if v == nil {
panic("v is nil")
}
@@ -99,7 +99,7 @@ func (v *Visor) Summary() (*Summary, error) {
panic("tpM is nil")
}
v.tpM.WalkTransports(func(tp *transport.ManagedTransport) bool {
- summaries = append(summaries,
+ tSummaries = append(tSummaries,
newTransportSummary(v.tpM, tp, true, v.router.SetupIsTrusted(tp.Remote())))
return true
})
@@ -114,38 +114,40 @@ func (v *Visor) Summary() (*Summary, error) {
return nil, fmt.Errorf("failed to get IPs of interface %s: %w", defaultNetworkIfc, err)
}
- summary := &Summary{
+ overview := &Overview{
PubKey: v.conf.PK,
BuildInfo: buildinfo.Get(),
AppProtoVersion: supportedProtocolVersion,
Apps: v.appL.AppStates(),
- Transports: summaries,
+ Transports: tSummaries,
RoutesCount: v.router.RoutesCount(),
}
if len(localIPs) > 0 {
// should be okay to have the first one, in the case of
// active network interface, there's usually just a single IP
- summary.LocalIP = localIPs[0].String()
+ overview.LocalIP = localIPs[0].String()
}
- return summary, nil
+ return overview, nil
}
-// ExtraSummary provides an extra summary of a Skywire Visor.
-type ExtraSummary struct {
- Summary *Summary `json:"summary"`
- Dmsg []dmsgtracker.DmsgClientSummary `json:"dmsg"`
- Health *HealthInfo `json:"health"`
- Uptime float64 `json:"uptime"`
- Routes []routingRuleResp `json:"routes"`
+// Summary provides detailed info including overview and health of the visor.
+type Summary struct {
+ Overview *Overview `json:"overview"`
+ Health *HealthInfo `json:"health"`
+ Uptime float64 `json:"uptime"`
+ Routes []routingRuleResp `json:"routes"`
+ IsHypervisor bool `json:"is_hypervisor,omitempty"`
+ DmsgStats *dmsgtracker.DmsgClientSummary `json:"dmsg_stats"`
+ Online bool `json:"online"`
}
-// ExtraSummary implements API.
-func (v *Visor) ExtraSummary() (*ExtraSummary, error) {
- summary, err := v.Summary()
+// Summary implements API.
+func (v *Visor) Summary() (*Summary, error) {
+ overview, err := v.Overview()
if err != nil {
- return nil, fmt.Errorf("summary")
+ return nil, fmt.Errorf("overview")
}
health, err := v.Health()
@@ -172,14 +174,14 @@ func (v *Visor) ExtraSummary() (*ExtraSummary, error) {
})
}
- extraSummary := &ExtraSummary{
- Summary: summary,
- Health: health,
- Uptime: uptime,
- Routes: extraRoutes,
+ summary := &Summary{
+ Overview: overview,
+ Health: health,
+ Uptime: uptime,
+ Routes: extraRoutes,
}
- return extraSummary, nil
+ return summary, nil
}
// collectHealthStats for given services and return health statuses
@@ -456,12 +458,12 @@ func (v *Visor) GetAppStats(appName string) (appserver.AppStats, error) {
// GetAppConnectionsSummary implements API.
func (v *Visor) GetAppConnectionsSummary(appName string) ([]appserver.ConnectionSummary, error) {
- summary, err := v.procM.ConnectionsSummary(appName)
+ cSummary, err := v.procM.ConnectionsSummary(appName)
if err != nil {
return nil, err
}
- return summary, nil
+ return cSummary, nil
}
// TransportTypes implements API.
diff --git a/pkg/visor/hypervisor.go b/pkg/visor/hypervisor.go
index b8c51ac9b..18fdba554 100644
--- a/pkg/visor/hypervisor.go
+++ b/pkg/visor/hypervisor.go
@@ -226,7 +226,7 @@ func (hv *Hypervisor) makeMux() chi.Router {
r.Get("/dmsg", hv.getDmsg())
r.Get("/visors", hv.getVisors())
- r.Get("/visors-summary", hv.getVisorsExtraSummary())
+ r.Get("/visors-summary", hv.getAllVisorsSummary())
r.Get("/visors/{pk}", hv.getVisor())
r.Get("/visors/{pk}/summary", hv.getVisorSummary())
r.Get("/visors/{pk}/health", hv.getHealth())
@@ -381,13 +381,7 @@ func (hv *Hypervisor) getUptime() http.HandlerFunc {
})
}
-type summaryResp struct {
- TCPAddr string `json:"tcp_addr"`
- Online bool `json:"online"`
- *Summary
-}
-
-// provides summary of all visors.
+// provides overview of all visors.
func (hv *Hypervisor) getVisors() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
hv.mu.RLock()
@@ -399,21 +393,16 @@ func (hv *Hypervisor) getVisors() http.HandlerFunc {
i++
}
- summaries := make([]summaryResp, len(hv.visors)+i)
+ overviews := make([]Overview, len(hv.visors)+i)
if hv.visor != nil {
- summary, err := hv.visor.Summary()
+ overview, err := hv.visor.Overview()
if err != nil {
- log.WithError(err).Warn("Failed to obtain summary of this visor.")
- summary = &Summary{PubKey: hv.visor.conf.PK}
+ log.WithError(err).Warn("Failed to obtain overview of this visor.")
+ overview = &Overview{PubKey: hv.visor.conf.PK}
}
- addr := dmsg.Addr{PK: hv.c.PK, Port: hv.c.DmsgPort}
- summaries[0] = summaryResp{
- TCPAddr: addr.String(),
- Online: err == nil,
- Summary: summary,
- }
+ overviews[0] = *overview
}
for pk, c := range hv.visors {
@@ -422,21 +411,17 @@ func (hv *Hypervisor) getVisors() http.HandlerFunc {
WithField("visor_addr", c.Addr).
WithField("func", "getVisors")
- log.Debug("Requesting summary via RPC.")
+ log.Debug("Requesting overview via RPC.")
- summary, err := c.API.Summary()
+ overview, err := c.API.Overview()
if err != nil {
log.WithError(err).
- Warn("Failed to obtain summary via RPC.")
- summary = &Summary{PubKey: pk}
+ Warn("Failed to obtain overview via RPC.")
+ overview = &Overview{PubKey: pk}
} else {
- log.Debug("Obtained summary via RPC.")
- }
- summaries[i] = summaryResp{
- TCPAddr: c.Addr.String(),
- Online: err == nil,
- Summary: summary,
+ log.Debug("Obtained overview via RPC.")
}
+ overviews[i] = *overview
wg.Done()
}(pk, c, i)
i++
@@ -445,74 +430,54 @@ func (hv *Hypervisor) getVisors() http.HandlerFunc {
wg.Wait()
hv.mu.RUnlock()
- httputil.WriteJSON(w, r, http.StatusOK, summaries)
+ httputil.WriteJSON(w, r, http.StatusOK, overviews)
}
}
-// provides summary of single visor.
+// provides overview of single visor.
func (hv *Hypervisor) getVisor() http.HandlerFunc {
return hv.withCtx(hv.visorCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {
- summary, err := ctx.API.Summary()
+ overview, err := ctx.API.Overview()
if err != nil {
httputil.WriteJSON(w, r, http.StatusInternalServerError, err)
return
}
- httputil.WriteJSON(w, r, http.StatusOK, summaryResp{
- TCPAddr: ctx.Addr.String(),
- Summary: summary,
- })
+ httputil.WriteJSON(w, r, http.StatusOK, overview)
})
}
-type extraSummaryResp struct {
- TCPAddr string `json:"tcp_addr"`
- Online bool `json:"online"`
- *ExtraSummary
-}
-
// provides extra summary of single visor.
func (hv *Hypervisor) getVisorSummary() http.HandlerFunc {
return hv.withCtx(hv.visorCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {
- extraSummary, err := ctx.API.ExtraSummary()
+ summary, err := ctx.API.Summary()
if err != nil {
httputil.WriteJSON(w, r, http.StatusInternalServerError, err)
return
}
- extraSummary.Dmsg = hv.getDmsgSummary()
+ dmsgStats := make(map[string]dmsgtracker.DmsgClientSummary)
+ dSummary := hv.getDmsgSummary()
+ for _, stat := range dSummary {
+ dmsgStats[stat.PK.String()] = stat
+ }
- httputil.WriteJSON(w, r, http.StatusOK, extraSummaryResp{
- TCPAddr: ctx.Addr.String(),
- ExtraSummary: extraSummary,
- })
+ if stat, ok := dmsgStats[summary.Overview.PubKey.String()]; ok {
+ summary.DmsgStats = &stat
+ } else {
+ summary.DmsgStats = &dmsgtracker.DmsgClientSummary{}
+ }
+ httputil.WriteJSON(w, r, http.StatusOK, summary)
})
}
-type extraSummaryWithDmsgResp struct {
- Summary *Summary `json:"summary"`
- Health *HealthInfo `json:"health"`
- Uptime float64 `json:"uptime"`
- Routes []routingRuleResp `json:"routes"`
- TCPAddr string `json:"tcp_addr"`
- Online bool `json:"online"`
- IsHypervisor bool `json:"is_hypervisor"`
- DmsgStats *dmsgtracker.DmsgClientSummary `json:"dmsg_stats"`
-}
-
-func makeExtraSummaryResp(online, hyper bool, addr dmsg.Addr, extra *ExtraSummary) extraSummaryWithDmsgResp {
- var resp extraSummaryWithDmsgResp
- resp.TCPAddr = addr.String()
- resp.Online = online
- resp.IsHypervisor = hyper
- resp.Summary = extra.Summary
- resp.Health = extra.Health
- resp.Uptime = extra.Uptime
- resp.Routes = extra.Routes
- return resp
+func makeSummaryResp(online, hyper bool, sum *Summary) Summary {
+ sum.Online = online
+ sum.IsHypervisor = hyper
+ return *sum
}
-func (hv *Hypervisor) getVisorsExtraSummary() http.HandlerFunc {
+func (hv *Hypervisor) getAllVisorsSummary() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
hv.mu.RLock()
wg := new(sync.WaitGroup)
@@ -530,21 +495,20 @@ func (hv *Hypervisor) getVisorsExtraSummary() http.HandlerFunc {
wg.Done()
}()
- summaries := make([]extraSummaryWithDmsgResp, len(hv.visors)+i)
+ summaries := make([]Summary, len(hv.visors)+i)
- summary, err := hv.visor.ExtraSummary()
+ summary, err := hv.visor.Summary()
if err != nil {
log.WithError(err).Warn("Failed to obtain summary of this visor.")
- summary = &ExtraSummary{
- Summary: &Summary{
+ summary = &Summary{
+ Overview: &Overview{
PubKey: hv.visor.conf.PK,
},
Health: &HealthInfo{},
}
}
- addr := dmsg.Addr{PK: hv.c.PK, Port: hv.c.DmsgPort}
- summaries[0] = makeExtraSummaryResp(err == nil, true, addr, summary)
+ summaries[0] = makeSummaryResp(err == nil, true, summary)
for pk, c := range hv.visors {
go func(pk cipher.PubKey, c Conn, i int) {
@@ -554,13 +518,13 @@ func (hv *Hypervisor) getVisorsExtraSummary() http.HandlerFunc {
log.Debug("Requesting summary via RPC.")
- summary, err := c.API.ExtraSummary()
+ summary, err := c.API.Summary()
if err != nil {
log.WithError(err).
Warn("Failed to obtain summary via RPC.", pk)
- summary = &ExtraSummary{
- Summary: &Summary{
+ summary = &Summary{
+ Overview: &Overview{
PubKey: pk,
},
Health: &HealthInfo{},
@@ -568,7 +532,7 @@ func (hv *Hypervisor) getVisorsExtraSummary() http.HandlerFunc {
} else {
log.Debug("Obtained summary via RPC.")
}
- resp := makeExtraSummaryResp(err == nil, false, c.Addr, summary)
+ resp := makeSummaryResp(err == nil, false, summary)
summaries[i] = resp
wg.Done()
}(pk, c, i)
@@ -577,7 +541,7 @@ func (hv *Hypervisor) getVisorsExtraSummary() http.HandlerFunc {
wg.Wait()
for i := 0; i < len(summaries); i++ {
- if stat, ok := dmsgStats[summaries[i].Summary.PubKey.String()]; ok {
+ if stat, ok := dmsgStats[summaries[i].Overview.PubKey.String()]; ok {
summaries[i].DmsgStats = &stat
} else {
summaries[i].DmsgStats = &dmsgtracker.DmsgClientSummary{}
@@ -756,13 +720,13 @@ func (hv *Hypervisor) appLogsSince() http.HandlerFunc {
func (hv *Hypervisor) appConnections() http.HandlerFunc {
return hv.withCtx(hv.appCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {
- summary, err := ctx.API.GetAppConnectionsSummary(ctx.App.Name)
+ cSummary, err := ctx.API.GetAppConnectionsSummary(ctx.App.Name)
if err != nil {
httputil.WriteJSON(w, r, http.StatusInternalServerError, err)
return
}
- httputil.WriteJSON(w, r, http.StatusOK, &summary)
+ httputil.WriteJSON(w, r, http.StatusOK, &cSummary)
})
}
@@ -822,13 +786,13 @@ func (hv *Hypervisor) postTransport() http.HandlerFunc {
}
const timeout = 30 * time.Second
- summary, err := ctx.API.AddTransport(reqBody.Remote, reqBody.TpType, reqBody.Public, timeout)
+ tSummary, err := ctx.API.AddTransport(reqBody.Remote, reqBody.TpType, reqBody.Public, timeout)
if err != nil {
httputil.WriteJSON(w, r, http.StatusInternalServerError, err)
return
}
- httputil.WriteJSON(w, r, http.StatusOK, summary)
+ httputil.WriteJSON(w, r, http.StatusOK, tSummary)
})
}
@@ -984,8 +948,8 @@ func (hv *Hypervisor) getRoute() http.HandlerFunc {
func (hv *Hypervisor) putRoute() http.HandlerFunc {
return hv.withCtx(hv.routeCtx, func(w http.ResponseWriter, r *http.Request, ctx *httpCtx) {
- var summary routing.RuleSummary
- if err := httputil.ReadJSON(r, &summary); err != nil {
+ var rSummary routing.RuleSummary
+ if err := httputil.ReadJSON(r, &rSummary); err != nil {
if err != io.EOF {
hv.log(r).Warnf("putRoute request: %v", err)
}
@@ -995,7 +959,7 @@ func (hv *Hypervisor) putRoute() http.HandlerFunc {
return
}
- rule, err := summary.ToRule()
+ rule, err := rSummary.ToRule()
if err != nil {
httputil.WriteJSON(w, r, http.StatusBadRequest, err)
return
@@ -1290,7 +1254,7 @@ func (hv *Hypervisor) visorUpdateAvailable() http.HandlerFunc {
return
}
- summary, err := ctx.API.Summary()
+ overview, err := ctx.API.Overview()
if err != nil {
httputil.WriteJSON(w, r, http.StatusInternalServerError, err)
return
@@ -1303,7 +1267,7 @@ func (hv *Hypervisor) visorUpdateAvailable() http.HandlerFunc {
ReleaseURL string `json:"release_url,omitempty"`
}{
Available: version != nil,
- CurrentVersion: summary.BuildInfo.Version,
+ CurrentVersion: overview.BuildInfo.Version,
}
if version != nil {
diff --git a/pkg/visor/rpc.go b/pkg/visor/rpc.go
index d8c88e9ff..76f18c99a 100644
--- a/pkg/visor/rpc.go
+++ b/pkg/visor/rpc.go
@@ -143,9 +143,9 @@ func newTransportSummary(tm *transport.Manager, tp *transport.ManagedTransport,
return summary
}
-// ExtraSummary provides an extra summary of the AppNode.
-func (r *RPC) ExtraSummary(_ *struct{}, out *ExtraSummary) (err error) {
- summary, err := r.visor.Summary()
+// Summary provides an extra summary of the AppNode.
+func (r *RPC) Summary(_ *struct{}, out *Summary) (err error) {
+ overview, err := r.visor.Overview()
if err != nil {
return fmt.Errorf("summary")
}
@@ -174,23 +174,23 @@ func (r *RPC) ExtraSummary(_ *struct{}, out *ExtraSummary) (err error) {
})
}
- *out = ExtraSummary{
- Summary: summary,
- Health: health,
- Uptime: uptime,
- Routes: extraRoutes,
+ *out = Summary{
+ Overview: overview,
+ Health: health,
+ Uptime: uptime,
+ Routes: extraRoutes,
}
return nil
}
-// Summary provides a summary of the AppNode.
-func (r *RPC) Summary(_ *struct{}, out *Summary) (err error) {
- defer rpcutil.LogCall(r.log, "Summary", nil)(out, &err)
+// Overview provides a overview of the AppNode.
+func (r *RPC) Overview(_ *struct{}, out *Overview) (err error) {
+ defer rpcutil.LogCall(r.log, "Overview", nil)(out, &err)
- summary, err := r.visor.Summary()
- if summary != nil {
- *out = *summary
+ overview, err := r.visor.Overview()
+ if overview != nil {
+ *out = *overview
}
return err
diff --git a/pkg/visor/rpc_client.go b/pkg/visor/rpc_client.go
index 16a013418..bdddf7309 100644
--- a/pkg/visor/rpc_client.go
+++ b/pkg/visor/rpc_client.go
@@ -92,13 +92,6 @@ func (rc *rpcClient) Call(method string, args, reply interface{}) error {
}
}
-// ExtraSummary calls ExtraSummary.
-func (rc *rpcClient) ExtraSummary() (*ExtraSummary, error) {
- out := new(ExtraSummary)
- err := rc.Call("ExtraSummary", &struct{}{}, out)
- return out, err
-}
-
// Summary calls Summary.
func (rc *rpcClient) Summary() (*Summary, error) {
out := new(Summary)
@@ -106,6 +99,13 @@ func (rc *rpcClient) Summary() (*Summary, error) {
return out, err
}
+// Overview calls Overview.
+func (rc *rpcClient) Overview() (*Overview, error) {
+ out := new(Overview)
+ err := rc.Call("Overview", &struct{}{}, out)
+ return out, err
+}
+
// Health calls Health
func (rc *rpcClient) Health() (*HealthInfo, error) {
hi := &HealthInfo{}
@@ -431,7 +431,7 @@ func (rc *rpcClient) UpdateStatus() (string, error) {
// MockRPCClient mocks API.
type mockRPCClient struct {
startedAt time.Time
- s *Summary
+ o *Overview
tpTypes []string
rt routing.Table
logS appcommon.LogStore
@@ -507,7 +507,7 @@ func NewMockRPCClient(r *rand.Rand, maxTps int, maxRules int) (cipher.PubKey, AP
log.Printf("rtCount: %d", rt.Count())
client := &mockRPCClient{
- s: &Summary{
+ o: &Overview{
PubKey: localPK,
BuildInfo: buildinfo.Get(),
AppProtoVersion: supportedProtocolVersion,
@@ -537,28 +537,28 @@ func (mc *mockRPCClient) do(write bool, f func() error) error {
return f()
}
-// Summary implements API.
-func (mc *mockRPCClient) Summary() (*Summary, error) {
- var out Summary
+// Overview implements API.
+func (mc *mockRPCClient) Overview() (*Overview, error) {
+ var out Overview
err := mc.do(false, func() error {
- out = *mc.s
- for _, a := range mc.s.Apps {
+ out = *mc.o
+ for _, a := range mc.o.Apps {
a := a
out.Apps = append(out.Apps, a)
}
- for _, tp := range mc.s.Transports {
+ for _, tp := range mc.o.Transports {
tp := tp
out.Transports = append(out.Transports, tp)
}
- out.RoutesCount = mc.s.RoutesCount
+ out.RoutesCount = mc.o.RoutesCount
return nil
})
return &out, err
}
-// ExtraSummary implements API.
-func (mc *mockRPCClient) ExtraSummary() (*ExtraSummary, error) {
- summary, err := mc.Summary()
+// Summary implements API.
+func (mc *mockRPCClient) Summary() (*Summary, error) {
+ overview, err := mc.Overview()
if err != nil {
return nil, err
}
@@ -587,14 +587,14 @@ func (mc *mockRPCClient) ExtraSummary() (*ExtraSummary, error) {
})
}
- extraSummary := &ExtraSummary{
- Summary: summary,
- Health: health,
- Uptime: uptime,
- Routes: extraRoutes,
+ summary := &Summary{
+ Overview: overview,
+ Health: health,
+ Uptime: uptime,
+ Routes: extraRoutes,
}
- return extraSummary, nil
+ return summary, nil
}
// Health implements API
@@ -619,7 +619,7 @@ func (mc *mockRPCClient) Uptime() (float64, error) {
func (mc *mockRPCClient) Apps() ([]*launcher.AppState, error) {
var apps []*launcher.AppState
err := mc.do(false, func() error {
- for _, a := range mc.s.Apps {
+ for _, a := range mc.o.Apps {
a := a
apps = append(apps, a)
}
@@ -641,7 +641,7 @@ func (*mockRPCClient) StopApp(string) error {
// SetAppDetailedStatus sets app's detailed state.
func (mc *mockRPCClient) SetAppDetailedStatus(appName, status string) error {
return mc.do(true, func() error {
- for _, a := range mc.s.Apps {
+ for _, a := range mc.o.Apps {
if a.Name == appName {
a.DetailedStatus = status
return nil
@@ -660,7 +660,7 @@ func (*mockRPCClient) RestartApp(string) error {
// SetAutoStart implements API.
func (mc *mockRPCClient) SetAutoStart(appName string, autostart bool) error {
return mc.do(true, func() error {
- for _, a := range mc.s.Apps {
+ for _, a := range mc.o.Apps {
if a.Name == appName {
a.AutoStart = autostart
return nil
@@ -675,8 +675,8 @@ func (mc *mockRPCClient) SetAppPassword(string, string) error {
return mc.do(true, func() error {
const socksName = "skysocks"
- for i := range mc.s.Apps {
- if mc.s.Apps[i].Name == socksName {
+ for i := range mc.o.Apps {
+ if mc.o.Apps[i].Name == socksName {
return nil
}
}
@@ -690,8 +690,8 @@ func (mc *mockRPCClient) SetAppPK(string, cipher.PubKey) error {
return mc.do(true, func() error {
const socksName = "skysocks-client"
- for i := range mc.s.Apps {
- if mc.s.Apps[i].Name == socksName {
+ for i := range mc.o.Apps {
+ if mc.o.Apps[i].Name == socksName {
return nil
}
}
@@ -705,8 +705,8 @@ func (mc *mockRPCClient) SetAppKillswitch(appName string, killswitch bool) error
return mc.do(true, func() error {
const socksName = "skysocks"
- for i := range mc.s.Apps {
- if mc.s.Apps[i].Name == socksName {
+ for i := range mc.o.Apps {
+ if mc.o.Apps[i].Name == socksName {
return nil
}
}
@@ -720,8 +720,8 @@ func (mc *mockRPCClient) SetAppSecure(appName string, isSecure bool) error {
return mc.do(true, func() error {
const socksName = "skysocks"
- for i := range mc.s.Apps {
- if mc.s.Apps[i].Name == socksName {
+ for i := range mc.o.Apps {
+ if mc.o.Apps[i].Name == socksName {
return nil
}
}
@@ -753,7 +753,7 @@ func (mc *mockRPCClient) TransportTypes() ([]string, error) {
func (mc *mockRPCClient) Transports(types []string, pks []cipher.PubKey, logs bool) ([]*TransportSummary, error) {
var summaries []*TransportSummary
err := mc.do(false, func() error {
- for _, tp := range mc.s.Transports {
+ for _, tp := range mc.o.Transports {
tp := tp
if types != nil {
for _, reqT := range types {
@@ -790,7 +790,7 @@ func (mc *mockRPCClient) Transports(types []string, pks []cipher.PubKey, logs bo
func (mc *mockRPCClient) Transport(tid uuid.UUID) (*TransportSummary, error) {
var summary TransportSummary
err := mc.do(false, func() error {
- for _, tp := range mc.s.Transports {
+ for _, tp := range mc.o.Transports {
if tp.ID == tid {
summary = *tp
return nil
@@ -804,14 +804,14 @@ func (mc *mockRPCClient) Transport(tid uuid.UUID) (*TransportSummary, error) {
// AddTransport implements API.
func (mc *mockRPCClient) AddTransport(remote cipher.PubKey, tpType string, _ bool, _ time.Duration) (*TransportSummary, error) {
summary := &TransportSummary{
- ID: transport.MakeTransportID(mc.s.PubKey, remote, tpType),
- Local: mc.s.PubKey,
+ ID: transport.MakeTransportID(mc.o.PubKey, remote, tpType),
+ Local: mc.o.PubKey,
Remote: remote,
Type: tpType,
Log: new(transport.LogEntry),
}
return summary, mc.do(true, func() error {
- mc.s.Transports = append(mc.s.Transports, summary)
+ mc.o.Transports = append(mc.o.Transports, summary)
return nil
})
}
@@ -819,9 +819,9 @@ func (mc *mockRPCClient) AddTransport(remote cipher.PubKey, tpType string, _ boo
// RemoveTransport implements API.
func (mc *mockRPCClient) RemoveTransport(tid uuid.UUID) error {
return mc.do(true, func() error {
- for i, tp := range mc.s.Transports {
+ for i, tp := range mc.o.Transports {
if tp.ID == tid {
- mc.s.Transports = append(mc.s.Transports[:i], mc.s.Transports[i+1:]...)
+ mc.o.Transports = append(mc.o.Transports[:i], mc.o.Transports[i+1:]...)
return nil
}
}
diff --git a/static/skywire-manager-src/src/app/components/pages/node/node-info/node-info-content/node-info-content.component.html b/static/skywire-manager-src/src/app/components/pages/node/node-info/node-info-content/node-info-content.component.html
index 815fb77b4..3c3089f7b 100644
--- a/static/skywire-manager-src/src/app/components/pages/node/node-info/node-info-content/node-info-content.component.html
+++ b/static/skywire-manager-src/src/app/components/pages/node/node-info/node-info-content/node-info-content.component.html
@@ -17,10 +17,6 @@
{{ 'node.details.node-info.ip' | translate }}
-
- {{ 'node.details.node-info.port' | translate }}
-
-
{{ 'node.details.node-info.dmsg-server' | translate }}
diff --git a/static/skywire-manager-src/src/app/services/node.service.ts b/static/skywire-manager-src/src/app/services/node.service.ts
index 14d5305e7..6674e0f32 100644
--- a/static/skywire-manager-src/src/app/services/node.service.ts
+++ b/static/skywire-manager-src/src/app/services/node.service.ts
@@ -495,13 +495,11 @@ export class NodeService {
// Basic data.
node.online = response.online;
- node.tcpAddr = response.tcp_addr;
- node.port = this.getAddressPart(node.tcpAddr, 1);
- node.localPk = response.summary.local_pk;
+ node.localPk = response.overview.local_pk;
// Ip.
- if (response.summary.local_ip && (response.summary.local_ip as string).trim()) {
- node.ip = response.summary.local_ip;
+ if (response.overview.local_ip && (response.overview.local_ip as string).trim()) {
+ node.ip = response.overview.local_ip;
} else {
node.ip = null;
}
@@ -602,16 +600,13 @@ export class NodeService {
const node = new Node();
// Basic data.
- node.online = response.online;
- node.tcpAddr = response.tcp_addr;
- node.port = this.getAddressPart(node.tcpAddr, 1);
- node.localPk = response.summary.local_pk;
- node.version = response.summary.build_info.version;
+ node.localPk = response.overview.local_pk;
+ node.version = response.overview.build_info.version;
node.secondsOnline = Math.floor(Number.parseFloat(response.uptime));
// Ip.
- if (response.summary.local_ip && (response.summary.local_ip as string).trim()) {
- node.ip = response.summary.local_ip;
+ if (response.overview.local_ip && (response.overview.local_ip as string).trim()) {
+ node.ip = response.overview.local_ip;
} else {
node.ip = null;
}
@@ -632,8 +627,8 @@ export class NodeService {
// Transports.
node.transports = [];
- if (response.summary.transports) {
- (response.summary.transports as any[]).forEach(transport => {
+ if (response.overview.transports) {
+ (response.overview.transports as any[]).forEach(transport => {
node.transports.push({
isUp: transport.is_up,
id: transport.id,
@@ -706,8 +701,8 @@ export class NodeService {
// Apps.
node.apps = [];
- if (response.summary.apps) {
- (response.summary.apps as any[]).forEach(app => {
+ if (response.overview.apps) {
+ (response.overview.apps as any[]).forEach(app => {
node.apps.push({
name: app.name,
status: app.status,
@@ -719,14 +714,11 @@ export class NodeService {
}
let dmsgServerFound = false;
- for (let i = 0; i < response.dmsg.length; i++) {
- if (response.dmsg[i].public_key === node.localPk) {
- node.dmsgServerPk = response.dmsg[i].server_public_key;
- node.roundTripPing = this.nsToMs(response.dmsg[i].round_trip);
+ if (response.dmsg_stats) {
+ node.dmsgServerPk = response.dmsg_stats.server_public_key;
+ node.roundTripPing = this.nsToMs(response.dmsg_stats.round_trip);
- dmsgServerFound = true;
- break;
- }
+ dmsgServerFound = true;
}
if (!dmsgServerFound) {