NewDefaultServer: New mysql server with default settings. NOTES: TLS support will be enabled by default with auto-generated CA and server certificates (however, you can still use non-TLS connection). By default, it will verify the client certificate if present. You can enable TLS support on the cli
()
| 44 | // the client side without providing a client-side certificate. So only when you need the server to verify client |
| 45 | // identity for maximum security, you need to set a signed certificate for the client. |
| 46 | func NewDefaultServer() *Server { |
| 47 | caPem, caKey := generateCA() |
| 48 | certPem, keyPem := generateAndSignRSACerts(caPem, caKey) |
| 49 | tlsConf := NewServerTLSConfig(caPem, certPem, keyPem, tls.VerifyClientCertIfGiven) |
| 50 | return &Server{ |
| 51 | serverVersion: "5.7.0", |
| 52 | protocolVersion: 10, |
| 53 | capability: CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB | CLIENT_PROTOCOL_41 | |
| 54 | CLIENT_TRANSACTIONS | CLIENT_SECURE_CONNECTION | CLIENT_PLUGIN_AUTH | CLIENT_SSL | CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA, |
| 55 | collationId: DEFAULT_COLLATION_ID, |
| 56 | defaultAuthMethod: AUTH_NATIVE_PASSWORD, |
| 57 | pubKey: getPublicKeyFromCert(certPem), |
| 58 | tlsConfig: tlsConf, |
| 59 | cacheShaPassword: new(sync.Map), |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // NewServer: New mysql server with customized settings. |
| 64 | // |
no test coverage detected