Status show IP's (#291)
This commit is contained in:
		
							parent
							
								
									a866977cb0
								
							
						
					
					
						commit
						cc285c5c20
					
				|  | @ -617,6 +617,8 @@ func Status(db store.IStore) echo.HandlerFunc { | ||||||
| 		LastHandshakeTime time.Time | 		LastHandshakeTime time.Time | ||||||
| 		LastHandshakeRel  time.Duration | 		LastHandshakeRel  time.Duration | ||||||
| 		Connected         bool | 		Connected         bool | ||||||
|  | 		AllocatedIP       string | ||||||
|  | 		Endpoint          string | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	type DeviceVM struct { | 	type DeviceVM struct { | ||||||
|  | @ -664,12 +666,21 @@ func Status(db store.IStore) echo.HandlerFunc { | ||||||
| 			for i := range devices { | 			for i := range devices { | ||||||
| 				devVm := DeviceVM{Name: devices[i].Name} | 				devVm := DeviceVM{Name: devices[i].Name} | ||||||
| 				for j := range devices[i].Peers { | 				for j := range devices[i].Peers { | ||||||
|  | 					var allocatedIPs string | ||||||
|  | 					for _, ip := range devices[i].Peers[j].AllowedIPs { | ||||||
|  | 						if len(allocatedIPs) > 0 { | ||||||
|  | 							allocatedIPs += "</br>" | ||||||
|  | 						} | ||||||
|  | 						allocatedIPs += ip.String() | ||||||
|  | 					} | ||||||
| 					pVm := PeerVM{ | 					pVm := PeerVM{ | ||||||
| 						PublicKey:         devices[i].Peers[j].PublicKey.String(), | 						PublicKey:         devices[i].Peers[j].PublicKey.String(), | ||||||
| 						ReceivedBytes:     devices[i].Peers[j].ReceiveBytes, | 						ReceivedBytes:     devices[i].Peers[j].ReceiveBytes, | ||||||
| 						TransmitBytes:     devices[i].Peers[j].TransmitBytes, | 						TransmitBytes:     devices[i].Peers[j].TransmitBytes, | ||||||
| 						LastHandshakeTime: devices[i].Peers[j].LastHandshakeTime, | 						LastHandshakeTime: devices[i].Peers[j].LastHandshakeTime, | ||||||
| 						LastHandshakeRel:  time.Since(devices[i].Peers[j].LastHandshakeTime), | 						LastHandshakeRel:  time.Since(devices[i].Peers[j].LastHandshakeTime), | ||||||
|  | 						AllocatedIP:       allocatedIPs, | ||||||
|  | 						Endpoint:          devices[i].Peers[j].Endpoint.String(), | ||||||
| 					} | 					} | ||||||
| 					pVm.Connected = pVm.LastHandshakeRel.Minutes() < 3. | 					pVm.Connected = pVm.LastHandshakeRel.Minutes() < 3. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -41,6 +41,8 @@ Connected Peers | ||||||
|                   <th scope="col">#</th> |                   <th scope="col">#</th> | ||||||
|                   <th scope="col">Name</th> |                   <th scope="col">Name</th> | ||||||
|                   <th scope="col">Email</th> |                   <th scope="col">Email</th> | ||||||
|  |                   <th scope="col">Allocated IPs</th> | ||||||
|  |                   <th scope="col">Endpoint</th> | ||||||
|                   <th scope="col">Public Key</th> |                   <th scope="col">Public Key</th> | ||||||
|                   <th scope="col">Received</th> |                   <th scope="col">Received</th> | ||||||
|                   <th scope="col">Transmitted</th> |                   <th scope="col">Transmitted</th> | ||||||
|  | @ -54,6 +56,8 @@ Connected Peers | ||||||
|                 <th scope="row">{{ $idx }}</th> |                 <th scope="row">{{ $idx }}</th> | ||||||
|                 <td>{{ $peer.Name }}</td> |                 <td>{{ $peer.Name }}</td> | ||||||
|                 <td>{{ $peer.Email }}</td> |                 <td>{{ $peer.Email }}</td> | ||||||
|  |                 <td>{{ $peer.AllocatedIP }}</td> | ||||||
|  |                 <td>{{ $peer.Endpoint }}</td> | ||||||
|                 <td>{{ $peer.PublicKey }}</td> |                 <td>{{ $peer.PublicKey }}</td> | ||||||
|                 <td title="{{ $peer.ReceivedBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.ReceivedBytes }}))</script></td> |                 <td title="{{ $peer.ReceivedBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.ReceivedBytes }}))</script></td> | ||||||
|                 <td title="{{ $peer.TransmitBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.TransmitBytes }}))</script></td> |                 <td title="{{ $peer.TransmitBytes }} Bytes"><script>document.write(bytesToHumanReadable({{ $peer.TransmitBytes }}))</script></td> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue