mirror of
https://github.com/libp2p/go-openssl.git
synced 2024-12-27 23:40:18 +08:00
add a few session cache options getters and setters
This commit is contained in:
parent
84b5df4774
commit
8d2efad227
40
ctx.go
40
ctx.go
@ -42,6 +42,22 @@ static long SSL_CTX_set_session_cache_mode_not_a_macro(SSL_CTX* ctx, long modes)
|
||||
return SSL_CTX_set_session_cache_mode(ctx, modes);
|
||||
}
|
||||
|
||||
static long SSL_CTX_sess_set_cache_size_not_a_macro(SSL_CTX* ctx, long t) {
|
||||
return SSL_CTX_sess_set_cache_size(ctx, t);
|
||||
}
|
||||
|
||||
static long SSL_CTX_sess_get_cache_size_not_a_macro(SSL_CTX* ctx) {
|
||||
return SSL_CTX_sess_get_cache_size(ctx);
|
||||
}
|
||||
|
||||
static long SSL_CTX_set_timeout_not_a_macro(SSL_CTX* ctx, long t) {
|
||||
return SSL_CTX_set_timeout(ctx, t);
|
||||
}
|
||||
|
||||
static long SSL_CTX_get_timeout_not_a_macro(SSL_CTX* ctx) {
|
||||
return SSL_CTX_get_timeout(ctx);
|
||||
}
|
||||
|
||||
static int CRYPTO_add_not_a_macro(int *pointer,int amount,int type) {
|
||||
return CRYPTO_add(pointer, amount, type);
|
||||
}
|
||||
@ -563,3 +579,27 @@ func (c *Ctx) SetSessionCacheMode(modes SessionCacheModes) SessionCacheModes {
|
||||
return SessionCacheModes(
|
||||
C.SSL_CTX_set_session_cache_mode_not_a_macro(c.ctx, C.long(modes)))
|
||||
}
|
||||
|
||||
// Set session cache timeout in seconds. Returns previously set value.
|
||||
// See https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html
|
||||
func (c *Ctx) SetTimeout(t int) int {
|
||||
return int(C.SSL_CTX_set_timeout_not_a_macro(c.ctx, C.long(t)))
|
||||
}
|
||||
|
||||
// Get session cache timeout in seconds.
|
||||
// See https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html
|
||||
func (c *Ctx) GetTimeout() int {
|
||||
return int(C.SSL_CTX_get_timeout_not_a_macro(c.ctx))
|
||||
}
|
||||
|
||||
// Set session cache size. Returns previously set value.
|
||||
// https://www.openssl.org/docs/ssl/SSL_CTX_sess_set_cache_size.html
|
||||
func (c *Ctx) SessSetCacheSize(t int) int {
|
||||
return int(C.SSL_CTX_sess_set_cache_size_not_a_macro(c.ctx, C.long(t)))
|
||||
}
|
||||
|
||||
// Get session cache size.
|
||||
// https://www.openssl.org/docs/ssl/SSL_CTX_sess_set_cache_size.html
|
||||
func (c *Ctx) SessGetCacheSize() int {
|
||||
return int(C.SSL_CTX_sess_get_cache_size_not_a_macro(c.ctx))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user