mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-04 09:17:32 -05:00
add tls config register
This commit is contained in:
parent
56e5c0e017
commit
690995d8ce
@ -6,6 +6,8 @@ option go_package = "github.com/v2fly/v2ray-core/v4/transport/internet/tls";
|
|||||||
option java_package = "com.v2ray.core.transport.internet.tls";
|
option java_package = "com.v2ray.core.transport.internet.tls";
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
|
|
||||||
|
import "common/protoext/extensions.proto";
|
||||||
|
|
||||||
message Certificate {
|
message Certificate {
|
||||||
// TLS certificate in x509 format.
|
// TLS certificate in x509 format.
|
||||||
bytes Certificate = 1;
|
bytes Certificate = 1;
|
||||||
@ -24,6 +26,9 @@ message Certificate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message Config {
|
message Config {
|
||||||
|
option (v2ray.core.common.protoext.message_opt).type = "security";
|
||||||
|
option (v2ray.core.common.protoext.message_opt).short_name = "tls";
|
||||||
|
|
||||||
// Whether or not to allow self-signed certificates.
|
// Whether or not to allow self-signed certificates.
|
||||||
bool allow_insecure = 1;
|
bool allow_insecure = 1;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package tls
|
package tls
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"github.com/v2fly/v2ray-core/v4/common"
|
||||||
|
|
||||||
"github.com/v2fly/v2ray-core/v4/common/buf"
|
"github.com/v2fly/v2ray-core/v4/common/buf"
|
||||||
"github.com/v2fly/v2ray-core/v4/common/net"
|
"github.com/v2fly/v2ray-core/v4/common/net"
|
||||||
@ -61,3 +63,9 @@ func Server(c net.Conn, config *tls.Config) net.Conn {
|
|||||||
tlsConn := tls.Server(c, config)
|
tlsConn := tls.Server(c, config)
|
||||||
return &Conn{Conn: tlsConn}
|
return &Conn{Conn: tlsConn}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
|
||||||
|
return nil, newError("tls should be used with v2tls")
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user