Files
virtuallan/pkg/server/alive_linux.go
lucheng 395129216e Windows supported
Support build windows client.
Use in windows, make sure you have been install tap-windows properly.
After launch, the windows client will now listen udp multicast
so if you need to config routes by yourself
2024-07-02 14:49:06 +08:00

28 lines
523 B
Go

package server
import (
"errors"
"fmt"
"strings"
log "github.com/sirupsen/logrus"
)
func HandleKeepalive(ipAddr, raddr string, svc *Server) error {
c, ok := UPool[raddr]
if !ok {
return errors.New("unauthed client")
}
log.Debugf("handle keepalive pkt for %s with ip %s", raddr, ipAddr)
if c.IP.String() != strings.Split(ipAddr, "/")[0] {
return fmt.Errorf("client %s ip should be %s, wrong ip %s in keepalive pkt", c.RAddr.String(), c.IP.String(), ipAddr)
}
// Heartbeat
c.Beat <- "ok"
return nil
}