Merge branch 'develop' into freebsd
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
711c025a48
@ -12,7 +12,7 @@ var v = validator.New()
|
||||
func init() {
|
||||
if err := v.RegisterValidation("iface", func(fl validator.FieldLevel) bool {
|
||||
name, ok := fl.Field().Interface().(string)
|
||||
if ok {
|
||||
if ok && name != "" {
|
||||
ifaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
log.Printf("error getting interfaces: %v", err)
|
||||
@ -60,6 +60,10 @@ type Peer struct {
|
||||
}
|
||||
|
||||
func (p Peer) GetLocalHost() string {
|
||||
if p.LocalHost == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
if err := v.Var(p.LocalHost, "ip"); err == nil {
|
||||
return p.LocalHost
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user