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 incb176c848e
, 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 ine24d61b7ef
. 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:
parent
12424cfa6f
commit
3e47a7505e
2 changed files with 32 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue