2016-08-06 18:38:23 -04:00
|
|
|
package noop
|
|
|
|
|
|
|
|
import (
|
2016-11-02 17:26:21 -04:00
|
|
|
"net"
|
|
|
|
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/common/alloc"
|
2016-10-16 08:22:21 -04:00
|
|
|
"v2ray.com/core/common/loader"
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/transport/internet"
|
2016-08-06 18:38:23 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type NoOpAuthenticator struct{}
|
|
|
|
|
|
|
|
func (this NoOpAuthenticator) Overhead() int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
func (this NoOpAuthenticator) Open(payload *alloc.Buffer) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
func (this NoOpAuthenticator) Seal(payload *alloc.Buffer) {}
|
|
|
|
|
|
|
|
type NoOpAuthenticatorFactory struct{}
|
|
|
|
|
2016-09-21 08:39:07 -04:00
|
|
|
func (this NoOpAuthenticatorFactory) Create(config interface{}) internet.Authenticator {
|
2016-08-06 18:38:23 -04:00
|
|
|
return NoOpAuthenticator{}
|
|
|
|
}
|
|
|
|
|
2016-10-31 17:26:46 -04:00
|
|
|
type NoOpConnectionAuthenticator struct{}
|
|
|
|
|
2016-11-02 17:26:21 -04:00
|
|
|
func (NoOpConnectionAuthenticator) Client(conn net.Conn) net.Conn {
|
|
|
|
return conn
|
2016-10-31 17:26:46 -04:00
|
|
|
}
|
|
|
|
|
2016-11-02 17:26:21 -04:00
|
|
|
func (NoOpConnectionAuthenticator) Server(conn net.Conn) net.Conn {
|
|
|
|
return conn
|
2016-10-31 17:26:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type NoOpConnectionAuthenticatorFactory struct{}
|
|
|
|
|
|
|
|
func (NoOpConnectionAuthenticatorFactory) Create(config interface{}) internet.ConnectionAuthenticator {
|
|
|
|
return NoOpConnectionAuthenticator{}
|
|
|
|
}
|
|
|
|
|
2016-08-06 18:38:23 -04:00
|
|
|
func init() {
|
2016-10-16 08:22:21 -04:00
|
|
|
internet.RegisterAuthenticator(loader.GetType(new(Config)), NoOpAuthenticatorFactory{})
|
2016-10-31 17:26:46 -04:00
|
|
|
internet.RegisterConnectionAuthenticator(loader.GetType(new(Config)), NoOpConnectionAuthenticatorFactory{})
|
2016-08-06 18:38:23 -04:00
|
|
|
}
|