mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-13 14:31:15 +00:00
peer expiry feature: database model, frontend updates
This commit is contained in:
@@ -36,6 +36,14 @@ func init() {
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
migrations = append(migrations, Migration{
|
||||
version: "1.0.9",
|
||||
migrateFn: func(db *gorm.DB) error {
|
||||
logrus.Infof("upgraded database format to version 1.0.9")
|
||||
return nil
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
type SupportedDatabase string
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BroadcastAddr returns the last address in the given network, or the broadcast address.
|
||||
@@ -21,7 +22,7 @@ func BroadcastAddr(n *net.IPNet) net.IP {
|
||||
return broadcast
|
||||
}
|
||||
|
||||
// http://play.golang.org/p/m8TNTtygK0
|
||||
// http://play.golang.org/p/m8TNTtygK0
|
||||
func IncreaseIP(ip net.IP) {
|
||||
for j := len(ip) - 1; j >= 0; j-- {
|
||||
ip[j]++
|
||||
@@ -84,3 +85,11 @@ func ByteCountSI(b int64) string {
|
||||
return fmt.Sprintf("%.1f %cB",
|
||||
float64(b)/float64(div), "kMGTPE"[exp])
|
||||
}
|
||||
|
||||
func FormatDateHTML(t *time.Time) string {
|
||||
if t == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return t.Format("2006-01-02")
|
||||
}
|
||||
|
Reference in New Issue
Block a user