1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-25 17:05:23 +00:00

add tls config register

This commit is contained in:
Shelikhoo 2021-09-05 10:26:17 +01:00
parent 56e5c0e017
commit 690995d8ce
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
2 changed files with 13 additions and 0 deletions

View File

@ -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_multiple_files = true;
import "common/protoext/extensions.proto";
message Certificate {
// TLS certificate in x509 format.
bytes Certificate = 1;
@ -24,6 +26,9 @@ message Certificate {
}
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.
bool allow_insecure = 1;

View File

@ -1,7 +1,9 @@
package tls
import (
"context"
"crypto/tls"
"github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/buf"
"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)
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")
}))
}