-
Notifications
You must be signed in to change notification settings - Fork 17
Block unblock ips #24
Block unblock ips #24
Conversation
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> refactors parse_config_value_set into a more central place Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> wip Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> refactor Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> more refactoring Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> wip Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> Revert "wip" This reverts commit 95a47e6. wip Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> wip Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> Revert "wip" This reverts commit 7903072. Revert "wip" This reverts commit 5344822.
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com> modifies parsing a hashset into a string so that it does not create an empty string at the beginning Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
89949bd to
b20202e
Compare
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
|
@pietroalbini @smarnach your feedback has been so helpful on previous pull requests, I would LOVE if you would take a look at this one when you have some time. |
…_app_config command Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
…OCKED_IPS env var Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
… per command Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
…s are currently blocked Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
|
Thank you for the review, @pietroalbini ! I believe I've addressed all your comments. |
smarnach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good to me.
I still think that we want to allow ops people to see the current value of the blocked IPs, but this is easy to change, so we can decide this when needed.
README.md
Outdated
|
|
||
| ``` | ||
| you: ~block_ip testing-nell-bot 123.456.68 | ||
| crates-io-bot: @you IP address 123.456.789 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the bot should reply with the same address as the one in the request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
er...yes...fixing the doc!
| params: empty_config_var(), | ||
| }); | ||
|
|
||
| let response_err = response.is_err(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can inline this variable – it's used only once.
src/utilities.rs
Outdated
| value_set.insert(String::from(string)); | ||
| } | ||
|
|
||
| value_set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this function body is equivalent to
config_value.split(',').map(String::from).collect()
src/utilities.rs
Outdated
| // Remove last comma | ||
| combined_string.pop(); | ||
|
|
||
| combined_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More concise alternative:
let non_empty: Vec<String> = config_value.into_iter().filter(|s| !s.is_empty()).collect();
non_empty.join(",")
There is not join() for arbitrary iterators of strings, so we need to collect into a vector first.
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
Adds a command to block an ip address and a command to unblock an ip address, according to the requirements in #4.