diff options
author | 2024-08-06 18:53:22 -0700 | |
---|---|---|
committer | 2024-08-06 18:53:22 -0700 | |
commit | 825ba9d21d15e1f9b34c60bac68e42ee1fb125f9 (patch) | |
tree | c466380d15d672a4619a7e1c15f058d52123dbb4 /backend/internal/ibd/options.go | |
parent | 961f9e0a76c3cfe9ae92ca8da0531790e0610b69 (diff) | |
download | ibd-trader-825ba9d21d15e1f9b34c60bac68e42ee1fb125f9.tar.gz ibd-trader-825ba9d21d15e1f9b34c60bac68e42ee1fb125f9.tar.zst ibd-trader-825ba9d21d15e1f9b34c60bac68e42ee1fb125f9.zip |
Improve selection of IBD transports
Diffstat (limited to 'backend/internal/ibd/options.go')
-rw-r--r-- | backend/internal/ibd/options.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/backend/internal/ibd/options.go b/backend/internal/ibd/options.go new file mode 100644 index 0000000..5c378d5 --- /dev/null +++ b/backend/internal/ibd/options.go @@ -0,0 +1,26 @@ +package ibd + +import "github.com/ansg191/ibd-trader-backend/internal/ibd/transport" + +type optionFunc func(*options) + +var defaultOptions = options{ + expectedStatuses: []int{200}, +} + +type options struct { + expectedStatuses []int + requiredProps transport.Properties +} + +func withExpectedStatuses(statuses ...int) optionFunc { + return func(o *options) { + o.expectedStatuses = append(o.expectedStatuses, statuses...) + } +} + +func withRequiredProps(props transport.Properties) optionFunc { + return func(o *options) { + o.requiredProps = props + } +} |