Skip to content

Commit

Permalink
changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Jan 19, 2024
1 parent 7a09f4a commit ed50d5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ func NewTtlCacheClb(address string, port string, lbType LoadBalancerType, ttl in
return buildClb(cache, lbType)
}

func NewDefaultTtlClb( ttl int ) LoadBalancer {
func NewTtl( ttl int ) LoadBalancer {
return NewDefaultTtlClb(RoundRobin, ttl)
}

func NewDefaultTtlClb(lbType LoadBalancerType, ttl int ) LoadBalancer {
lib := dns.NewDefaultLookupLib()
cache := ttlcache.NewTtlCache(lib, ttl)
return buildClb(cache, lbType)
Expand Down
11 changes: 11 additions & 0 deletions clb/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ func ExampleNew() {
// Output: 0.1.2.3:8001
}

func ExampleNewNewDefaultTtlClb() {
c := NewTtl(0)
address, err := c.GetAddress("foo.service.fligl.io")
if err != nil {
panic(err)
}

fmt.Printf("%s", address.String())
// Output: 0.1.2.3:8001
}

// Example address provider using defaults
func ExampleAddressProvider() {
ap := NewAddressProvider("foo.service.fligl.io")
Expand Down

0 comments on commit ed50d5c

Please sign in to comment.