Strip Advertise/Process from router
This commit is contained in:
@@ -4,6 +4,7 @@ package router
|
||||
type QueryOption func(*QueryOptions)
|
||||
|
||||
// QueryOptions are routing table query options
|
||||
// TODO replace with Filter(Route) bool
|
||||
type QueryOptions struct {
|
||||
// Service is destination service name
|
||||
Service string
|
||||
@@ -15,8 +16,8 @@ type QueryOptions struct {
|
||||
Network string
|
||||
// Router is router id
|
||||
Router string
|
||||
// Strategy is routing strategy
|
||||
Strategy Strategy
|
||||
// Link to query
|
||||
Link string
|
||||
}
|
||||
|
||||
// QueryService sets service to query
|
||||
@@ -54,10 +55,10 @@ func QueryRouter(r string) QueryOption {
|
||||
}
|
||||
}
|
||||
|
||||
// QueryStrategy sets strategy to query
|
||||
func QueryStrategy(s Strategy) QueryOption {
|
||||
// QueryLink sets the link to query
|
||||
func QueryLink(link string) QueryOption {
|
||||
return func(o *QueryOptions) {
|
||||
o.Strategy = s
|
||||
o.Link = link
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,12 +66,12 @@ func QueryStrategy(s Strategy) QueryOption {
|
||||
func NewQuery(opts ...QueryOption) QueryOptions {
|
||||
// default options
|
||||
qopts := QueryOptions{
|
||||
Service: "*",
|
||||
Address: "*",
|
||||
Gateway: "*",
|
||||
Network: "*",
|
||||
Router: "*",
|
||||
Strategy: AdvertiseAll,
|
||||
Service: "*",
|
||||
Address: "*",
|
||||
Gateway: "*",
|
||||
Network: "*",
|
||||
Router: "*",
|
||||
Link: DefaultLink,
|
||||
}
|
||||
|
||||
for _, o := range opts {
|
||||
|
||||
Reference in New Issue
Block a user