Added Router ID and query options to limit number of results
This commit is contained in:
		| @@ -88,7 +88,10 @@ func (r *router) Address() string { | |||||||
| func (r *router) String() string { | func (r *router) String() string { | ||||||
| 	sb := &strings.Builder{} | 	sb := &strings.Builder{} | ||||||
|  |  | ||||||
| 	s := fmt.Sprintf("Router Local Address: %s\n", r.opts.Address) | 	s := fmt.Sprintf("Router ID: %s\n", r.id.String()) | ||||||
|  | 	sb.WriteString(s) | ||||||
|  |  | ||||||
|  | 	s = fmt.Sprintf("Router Local Address: %s\n", r.opts.Address) | ||||||
| 	sb.WriteString(s) | 	sb.WriteString(s) | ||||||
|  |  | ||||||
| 	s = fmt.Sprintf("Router Network Address: %s\n", r.opts.Network) | 	s = fmt.Sprintf("Router Network Address: %s\n", r.opts.Network) | ||||||
|   | |||||||
| @@ -18,6 +18,8 @@ type QueryOptions struct { | |||||||
| 	Service string | 	Service string | ||||||
| 	// Policy defines query lookup policy | 	// Policy defines query lookup policy | ||||||
| 	Policy LookupPolicy | 	Policy LookupPolicy | ||||||
|  | 	// Count defines max number of results to return | ||||||
|  | 	Count int | ||||||
| } | } | ||||||
|  |  | ||||||
| // EntryOpts allows to set the route query options | // EntryOpts allows to set the route query options | ||||||
| @@ -41,6 +43,13 @@ func QueryLookupPolicy(p LookupPolicy) QueryOption { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ResultCount allows to set max results to return | ||||||
|  | func ResultCount(c int) QueryOption { | ||||||
|  | 	return func(o *QueryOptions) { | ||||||
|  | 		o.Count = c | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| // Query defines routing table query | // Query defines routing table query | ||||||
| type Query interface { | type Query interface { | ||||||
| 	// Options returns query options | 	// Options returns query options | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user