Add backend weight round robin select (#34)
[dns-over-https.git] / doh-client / selector / upstream.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package selector

import "fmt"

type UpstreamType int

const (
	Google UpstreamType = iota
	IETF
)

var typeMap = map[UpstreamType]string{
	Google: "Google",
	IETF:   "IETF",
}

type Upstream struct {
	Type            UpstreamType
	Url             string
	RequestType     string
	weight          int32
	effectiveWeight int32
	currentWeight   int32
}

func (u Upstream) String() string {
	return fmt.Sprintf("upstream type: %s, upstream url: %s", typeMap[u.Type], u.Url)
}