2018-02-09 10:40:57 +00:00
|
|
|
// Copyright (C) 2018 The Syncthing Authors.
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
package connections
|
|
|
|
|
|
|
|
import "github.com/syncthing/syncthing/lib/config"
|
|
|
|
|
2020-12-09 18:23:50 +00:00
|
|
|
// invalidListener is never valid
|
|
|
|
type invalidListener struct {
|
2018-02-09 10:40:57 +00:00
|
|
|
listenerFactory
|
2020-12-09 18:23:50 +00:00
|
|
|
err error
|
2018-02-09 10:40:57 +00:00
|
|
|
}
|
|
|
|
|
2020-12-09 18:23:50 +00:00
|
|
|
func (i invalidListener) Valid(_ config.Configuration) error {
|
|
|
|
if i.err == nil {
|
|
|
|
// fallback so we don't accidentally return nil
|
|
|
|
return errUnsupported
|
|
|
|
}
|
|
|
|
return i.err
|
2018-02-09 10:40:57 +00:00
|
|
|
}
|
|
|
|
|
2020-12-09 18:23:50 +00:00
|
|
|
// invalidDialer is never valid
|
|
|
|
type invalidDialer struct {
|
2018-02-09 10:40:57 +00:00
|
|
|
dialerFactory
|
2020-12-09 18:23:50 +00:00
|
|
|
err error
|
2018-02-09 10:40:57 +00:00
|
|
|
}
|
|
|
|
|
2020-12-09 18:23:50 +00:00
|
|
|
func (i invalidDialer) Valid(_ config.Configuration) error {
|
|
|
|
if i.err == nil {
|
|
|
|
// fallback so we don't accidentally return nil
|
|
|
|
return errUnsupported
|
|
|
|
}
|
|
|
|
return i.err
|
2018-02-09 10:40:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2020-12-09 18:23:50 +00:00
|
|
|
listeners["kcp"] = invalidListener{err: errDeprecated}
|
|
|
|
listeners["kcp4"] = invalidListener{err: errDeprecated}
|
|
|
|
listeners["kcp6"] = invalidListener{err: errDeprecated}
|
|
|
|
dialers["kcp"] = invalidDialer{err: errDeprecated}
|
|
|
|
dialers["kcp4"] = invalidDialer{err: errDeprecated}
|
|
|
|
dialers["kcp6"] = invalidDialer{err: errDeprecated}
|
2018-02-09 10:40:57 +00:00
|
|
|
}
|