Compare commits
No commits in common. "26ad05fd9e15c6b1ee73d6a264de90c82c404930" and "6dd90973516b7440b5f6abdbec8f751a7a4003c6" have entirely different histories.
26ad05fd9e
...
6dd9097351
@ -46,7 +46,7 @@ func check_ping(ip string, cb func(pkt *ping.Packet)) (err error) {
|
|||||||
pinger.Count = 1
|
pinger.Count = 1
|
||||||
pinger.OnRecv = cb
|
pinger.OnRecv = cb
|
||||||
pinger.SetPrivileged(true)
|
pinger.SetPrivileged(true)
|
||||||
err = pinger.Run()
|
pinger.Run()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ func check_dnssec(domain, ip string) (err error) {
|
|||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return fmt.Errorf("Unable to find a valid DS record in parent zone (if you use your own domain (ie. not given by maatma), this can be due to a previously cached response, you should wait).")
|
return fmt.Errorf("Unable to find a valid DS record in parent zone.")
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -560,24 +560,14 @@ func minTunnelVersion(std *adlin.Student, suffixip int) (int, error) {
|
|||||||
return minversion, nil
|
return minversion, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func studentChecker(std *adlin.Student, also_check_matrix bool, offline bool) {
|
func studentChecker(std *adlin.Student, also_check_matrix bool) {
|
||||||
tuns, err := std.GetActivesTunnels()
|
tuns, err := std.GetActivesTunnels()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if offline {
|
|
||||||
tuns, err = std.GetDefaultTunnels()
|
|
||||||
if err != nil {
|
|
||||||
if verbose {
|
|
||||||
log.Printf("SKip %s as I'm unable to generate default tunnels: %s", std.Login, err.Error())
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if verbose2 {
|
if verbose2 {
|
||||||
log.Printf("SKip %s due to error when getting active tunnels: %s", std.Login, err.Error())
|
log.Printf("SKip %s due to error when getting active tunnels: %s", std.Login, err.Error())
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if verbose2 && len(tuns) == 0 {
|
if verbose2 && len(tuns) == 0 {
|
||||||
log.Printf("%s has no active tunnels: %s", std.Login, err.Error())
|
log.Printf("%s has no active tunnels: %s", std.Login, err.Error())
|
||||||
}
|
}
|
||||||
@ -588,14 +578,14 @@ func studentChecker(std *adlin.Student, also_check_matrix bool, offline bool) {
|
|||||||
log.Printf("Tests %s on %s...", std.Login, stdIP)
|
log.Printf("Tests %s on %s...", std.Login, stdIP)
|
||||||
}
|
}
|
||||||
// Check ping
|
// Check ping
|
||||||
err = check_ping(stdIP, func(pkt *ping.Packet) {
|
check_ping(stdIP, func(pkt *ping.Packet) {
|
||||||
tunnel_version, err := minTunnelVersion(std, tun.SuffixIP)
|
tunnel_version, err := minTunnelVersion(std, tun.SuffixIP)
|
||||||
if verbose {
|
if verbose {
|
||||||
log.Printf("%s PONG (on %x); version=%d (%v)\n", std.Login, tun.SuffixIP, tunnel_version, err)
|
log.Printf("%s PONG (on %x); version=%d (%v)\n", std.Login, tun.SuffixIP, tunnel_version, err)
|
||||||
}
|
}
|
||||||
std.OnPong(true)
|
std.OnPong(true)
|
||||||
|
|
||||||
if !offline && (tunnel_version == 2147483647 || tunnel_version == 0) {
|
if tunnel_version == 2147483647 || tunnel_version == 0 {
|
||||||
log.Printf("%s unknown tunnel version: %d skipping tests (%v)", std.Login, tunnel_version, err)
|
log.Printf("%s unknown tunnel version: %d skipping tests (%v)", std.Login, tunnel_version, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -813,13 +803,11 @@ func studentChecker(std *adlin.Student, also_check_matrix bool, offline bool) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
if err != nil && verbose {
|
|
||||||
log.Printf("%s: Unable to perform ping to %s: %s", std.Login, stdIP, err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func studentsChecker(offline bool) {
|
}
|
||||||
|
|
||||||
|
func studentsChecker() {
|
||||||
students, err := adlin.GetStudents()
|
students, err := adlin.GetStudents()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Unable to check students:", err)
|
log.Println("Unable to check students:", err)
|
||||||
@ -831,6 +819,6 @@ func studentsChecker(offline bool) {
|
|||||||
|
|
||||||
for istd, s := range students {
|
for istd, s := range students {
|
||||||
time.Sleep(250 * time.Millisecond)
|
time.Sleep(250 * time.Millisecond)
|
||||||
go studentChecker(s, istd%10 == check_matrix_for, offline)
|
go studentChecker(s, istd%10 == check_matrix_for)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
offline := false
|
|
||||||
|
|
||||||
var dsn = flag.String("dsn", adlin.DSNGenerator(), "DSN to connect to the MySQL server")
|
var dsn = flag.String("dsn", adlin.DSNGenerator(), "DSN to connect to the MySQL server")
|
||||||
flag.BoolVar(&verbose, "verbose", verbose, "Enable verbose mode")
|
flag.BoolVar(&verbose, "verbose", verbose, "Enable verbose mode")
|
||||||
flag.BoolVar(&verbose2, "verbose2", verbose2, "Enable more verbose mode")
|
flag.BoolVar(&verbose2, "verbose2", verbose2, "Enable more verbose mode")
|
||||||
flag.BoolVar(&offline, "offline", offline, "Enable offline mode (doesn't check what wg report)")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if verbose2 && !verbose {
|
if verbose2 && !verbose {
|
||||||
@ -47,7 +44,7 @@ func main() {
|
|||||||
log.Printf("%s: %s", std_login, err.Error())
|
log.Printf("%s: %s", std_login, err.Error())
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Checking %s...", std.Login)
|
log.Printf("Checking %s...", std.Login)
|
||||||
studentChecker(std, true, offline)
|
studentChecker(std, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,14 +59,14 @@ func main() {
|
|||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
// Launch checker
|
// Launch checker
|
||||||
studentsChecker(offline)
|
studentsChecker()
|
||||||
loop:
|
loop:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-interrupt:
|
case <-interrupt:
|
||||||
break loop
|
break loop
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
studentsChecker(offline)
|
studentsChecker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,13 +225,6 @@ func (student *Student) GetActivesTunnels() (ts []*TunnelToken, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (student *Student) GetDefaultTunnels() (ts []*TunnelToken, err error) {
|
|
||||||
t := &TunnelToken{IdStudent: student.Id}
|
|
||||||
ts = append(ts, t)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (student *Student) GetActivesTunnelsPubKey() (ts []ed25519.PublicKey, err error) {
|
func (student *Student) GetActivesTunnelsPubKey() (ts []ed25519.PublicKey, err error) {
|
||||||
var activeTuns []*TunnelToken
|
var activeTuns []*TunnelToken
|
||||||
activeTuns, err = student.GetActivesTunnels()
|
activeTuns, err = student.GetActivesTunnels()
|
||||||
|
Reference in New Issue
Block a user