1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

daemon/logger/fluentd: remove udp, tcp+tls, unixgram, add tls scheme

unix and unixgram were added in cb176c848e, but at
the time, the driver only supported "tcp" and "unix":
cb176c848e/vendor/src/github.com/fluent/fluent-logger-golang/fluent/fluent.go (L243-L261)

support for tls was added in github.com/fluent/fluent-logger-golang v1.8.0, which
was vendored in e24d61b7ef.

the list of currently supported schemes by the driver is: tcp, tls and unix:
5179299b98/vendor/github.com/fluent/fluent-logger-golang/fluent/fluent.go (L435-L463)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-04-10 15:08:25 +02:00
parent 12424cfa6f
commit 3e47a7505e
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 32 additions and 2 deletions

View file

@ -285,12 +285,12 @@ func parseAddress(address string) (*location, error) {
}
switch addr.Scheme {
case "unix", "unixgram":
case "unix":
if strings.TrimLeft(addr.Path, "/") == "" {
return nil, errors.New("path is empty")
}
return &location{protocol: addr.Scheme, path: addr.Path}, nil
case "tcp", "tcp+tls", "udp":
case "tcp", "tls":
// continue processing below
default:
return nil, errors.Errorf("unsupported scheme: '%s'", addr.Scheme)

View file

@ -95,6 +95,24 @@ func TestValidateLogOptAddress(t *testing.T) {
host: "example.com",
},
},
{
addr: "tls://",
paths: paths,
expected: location{
protocol: "tls",
host: defaultHost,
port: defaultPort,
},
},
{
addr: "tls://example.com",
ports: validPorts,
paths: paths,
expected: location{
protocol: "tls",
host: "example.com",
},
},
{
addr: "://",
expectedErr: "missing protocol scheme",
@ -103,6 +121,18 @@ func TestValidateLogOptAddress(t *testing.T) {
addr: "something://",
expectedErr: "unsupported scheme: 'something'",
},
{
addr: "udp://",
expectedErr: "unsupported scheme: 'udp'",
},
{
addr: "unixgram://",
expectedErr: "unsupported scheme: 'unixgram'",
},
{
addr: "tcp+tls://",
expectedErr: "unsupported scheme: 'tcp+tls'",
},
{
addr: "corrupted:c",
expectedErr: "invalid port",