Skip to content

Commit

Permalink
Merge b5a4207 into 223e97f
Browse files Browse the repository at this point in the history
  • Loading branch information
shenhui0509 committed Jun 18, 2019
2 parents 223e97f + b5a4207 commit 8271565
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/auth/authorizations.go
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"log"
"math/rand"
"net/url"
"regexp"
"time"
Expand Down Expand Up @@ -78,7 +79,10 @@ func (a *State) IsExpired() bool {

func QueryAnyAuthd(authd []string, remoteIP string, tlsEnabled bool, commonName string, authSecret string,
connectTimeout time.Duration, requestTimeout time.Duration) (*State, error) {
for _, a := range authd {
start := rand.Int()
n := len(authd)
for i := 0; i < n; i++ {
a := authd[(i+start)%n]
authState, err := QueryAuthd(a, remoteIP, tlsEnabled, commonName, authSecret, connectTimeout, requestTimeout)
if err != nil {
log.Printf("Error: failed auth against %s %s", a, err)
Expand Down

0 comments on commit 8271565

Please sign in to comment.