Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

use inclusive language #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/red/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func makeConsulRegistry(u *url.URL) *consulRegistry {
Cache: &consul.ResolverCache{
CacheTimeout: 10 * time.Second,
},
Blacklist: &consul.ResolverBlacklist{},
Denylist: &consul.ResolverDenylist{},
},
}

Expand All @@ -194,7 +194,7 @@ func makeConsulRegistry(u *url.URL) *consulRegistry {
r.client.Address,
)

var _ redis.ServerBlacklist = r
var _ redis.ServerDenylist = r
return r
}

Expand Down Expand Up @@ -223,9 +223,9 @@ func (r *consulRegistry) LookupServers(ctx context.Context) ([]redis.ServerEndpo
return servers, nil
}

func (r *consulRegistry) BlacklistServer(server redis.ServerEndpoint) {
stats.Incr("blacklist_server.count")
r.resolver.Blacklist.Blacklist(stringAddr(server.Addr), time.Now().Add(10*time.Second))
func (r *consulRegistry) DenyServer(server redis.ServerEndpoint) {
stats.Incr("denied_server.count")
r.resolver.Denylist.Denylist(stringAddr(server.Addr), time.Now().Add(10*time.Second))
}

type stringAddr string
Expand Down
8 changes: 4 additions & 4 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (proxy *ReverseProxy) serveRequest(w ResponseWriter, req *Request) {
return
default:
w.Write(errorf("ERR Connecting to the upstream server failed."))
proxy.blacklistServer(upstream)
proxy.denyServer(upstream)
proxy.log(err)
return
}
Expand Down Expand Up @@ -161,9 +161,9 @@ func (proxy *ReverseProxy) lookupServers(ctx context.Context) ([]ServerEndpoint,
return r.LookupServers(ctx)
}

func (proxy *ReverseProxy) blacklistServer(upstream string) {
if b, ok := proxy.Registry.(ServerBlacklist); !ok {
b.BlacklistServer(ServerEndpoint{Addr: upstream})
func (proxy *ReverseProxy) denyServer(upstream string) {
if b, ok := proxy.Registry.(ServerDenylist); !ok {
b.DenylistServer(ServerEndpoint{Addr: upstream})
}
}

Expand Down
10 changes: 5 additions & 5 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ type ServerRegistry interface {
LookupServers(ctx context.Context) ([]ServerEndpoint, error)
}

// ServerBlacklist is implemented by some ServerRegistry to support black
// listing some server addresses.
type ServerBlacklist interface {
// Blacklist temporarily blacklists the given server endpoint.
BlacklistServer(ServerEndpoint)
// ServerDenyList is implemented by some ServerRegistry to support denying
// some server addresses.
type ServerDenylist interface {
// DenyServer temporarily denies the given server endpoint.
DenyServer(ServerEndpoint)
}

// A ServerEndpoint represents a single backend redis server.
Expand Down