diff options
| author | mo khan <mo@mokhan.ca> | 2026-01-31 23:57:00 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2026-01-31 23:57:00 -0700 |
| commit | 43fe420b419dee4e760288761a45ba47eb28ab2e (patch) | |
| tree | 8278476993599682af7489193d6b514056917775 /lib/net/hippie/tls_parser.rb | |
| parent | b8c1171c332a574c7c0a68538471daf82c386867 (diff) | |
feat: add connection pooling and DNS caching for performance
- Persistent HTTP sessions avoid Connection: close overhead
- DNS pre-resolution with timeout prevents indefinite hangs
- Thread-safe connection pool with LRU eviction
- TLS certificates parsed once at init, not per-request
- Extract TlsParser, DnsCache, ConnectionPool for SRP
Bump to v1.5.0
Diffstat (limited to 'lib/net/hippie/tls_parser.rb')
| -rw-r--r-- | lib/net/hippie/tls_parser.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/net/hippie/tls_parser.rb b/lib/net/hippie/tls_parser.rb new file mode 100644 index 0000000..b2a9d7d --- /dev/null +++ b/lib/net/hippie/tls_parser.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Net + module Hippie + # Parses TLS certificates and keys from various formats. + module TlsParser + def parse_cert(cert) + return cert if cert.is_a?(OpenSSL::X509::Certificate) || cert.nil? + + OpenSSL::X509::Certificate.new(cert) + end + + def parse_key(key, passphrase) + return key if key.is_a?(OpenSSL::PKey::PKey) || key.nil? + + passphrase ? OpenSSL::PKey::RSA.new(key, passphrase) : OpenSSL::PKey::RSA.new(key) + end + end + end +end |
