Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support tcp transport protocol #8

Merged
merged 2 commits into from
Jun 1, 2018

Conversation

colinsurprenant
Copy link
Contributor

Add support for tcp transport protocol.

I locally tested this both for udp and tcp and both are working. We are lacking test/spec coverage for this and I will followup with an initial spec for the client.

@@ -76,16 +76,20 @@ def register

host_details = host_name.match(HOST_REGEX)
raise(LogStash::ConfigurationError, "invalid format for host option '#{host_name}'") unless host_details
raise(LogStash::ConfigurationError, "only the udp protocol is supported for now") unless host_details[:host_protocol].to_s =~ /udp/i
raise(LogStash::ConfigurationError, "only udp & tcp protocols are supported") unless host_details[:host_protocol].to_s =~ /^(?:udp|tcp)$/i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like we do in the previous raise, here we should include the host string we're validating to help the user figure out where the mistake was.

@@ -54,13 +54,15 @@
{"get" => ["1.0"], "hosts" => [{"host" => "udp:localhost/161"}]},
{"get" => ["1.0"], "hosts" => [{"host" => "udp:127.0.0.1/112345"}]},
{"get" => ["1.0"], "hosts" => [{"host" => "udp:127.0.0.1/161", "community" => "public"}]},
{"get" => ["1.0"], "hosts" => [{"host" => "tcp:127.0.0.1/112345"}]},
{"get" => ["1.0"], "hosts" => [{"host" => "tcp:127.0.0.1/161", "community" => "public"}]},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should't this be 1161?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't have to be - note that we are only verifying the format here but in any case, the port number can be any number.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I was just aiming at consistency in the examples that reference 1161 for tcp in two other places.

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

add host info in exception
@colinsurprenant colinsurprenant merged commit a8b8a5e into logstash-plugins:master Jun 1, 2018
@colinsurprenant
Copy link
Contributor Author

Thanks @jsvd ! will be pushing 0.1.0.beta3 shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants