$37 GRAYBYTE WORDPRESS FILE MANAGER $28

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/golang/src/crypto/tls/

HOME
Current File : /usr/lib/golang/src/crypto/tls//cache.go
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package tls

import (
	"crypto/x509"
	"runtime"
	"sync"
	"weak"
)

// weakCertCache provides a cache of *x509.Certificates, allowing multiple
// connections to reuse parsed certificates, instead of re-parsing the
// certificate for every connection, which is an expensive operation.
type weakCertCache struct{ sync.Map }

func (wcc *weakCertCache) newCert(der []byte) (*x509.Certificate, error) {
	if entry, ok := wcc.Load(string(der)); ok {
		if v := entry.(weak.Pointer[x509.Certificate]).Value(); v != nil {
			return v, nil
		}
	}

	cert, err := x509.ParseCertificate(der)
	if err != nil {
		return nil, err
	}

	wp := weak.Make(cert)
	if entry, loaded := wcc.LoadOrStore(string(der), wp); !loaded {
		runtime.AddCleanup(cert, func(_ any) { wcc.CompareAndDelete(string(der), entry) }, any(string(der)))
	} else if v := entry.(weak.Pointer[x509.Certificate]).Value(); v != nil {
		return v, nil
	} else {
		if wcc.CompareAndSwap(string(der), entry, wp) {
			runtime.AddCleanup(cert, func(_ any) { wcc.CompareAndDelete(string(der), wp) }, any(string(der)))
		}
	}
	return cert, nil
}

var globalCertCache = new(weakCertCache)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.30 PM
root / root
0755
fipsonly
--
16 Dec 2025 9.30 PM
root / root
0755
internal
--
4 Dec 2025 6.06 PM
root / root
0755
alert.go
4.295 KB
4 Dec 2025 6.06 PM
root / root
0644
auth.go
9.687 KB
4 Dec 2025 6.06 PM
root / root
0644
bogo_config.json
17.998 KB
4 Dec 2025 6.06 PM
root / root
0644
cache.go
1.258 KB
4 Dec 2025 6.06 PM
root / root
0644
cipher_suites.go
25.916 KB
4 Dec 2025 6.06 PM
root / root
0644
common.go
65.561 KB
4 Dec 2025 6.06 PM
root / root
0644
common_string.go
3.375 KB
4 Dec 2025 6.06 PM
root / root
0644
conn.go
52.15 KB
4 Dec 2025 6.06 PM
root / root
0644
defaults.go
3.057 KB
4 Dec 2025 6.06 PM
root / root
0644
defaults_boring.go
1.729 KB
4 Dec 2025 6.06 PM
root / root
0644
defaults_fips140.go
2.329 KB
4 Dec 2025 6.06 PM
root / root
0644
ech.go
18.911 KB
4 Dec 2025 6.06 PM
root / root
0644
generate_cert.go
4.831 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_client.go
40.648 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_client_tls13.go
28.283 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_messages.go
52.43 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_server.go
30.376 KB
4 Dec 2025 6.06 PM
root / root
0644
handshake_server_tls13.go
35.632 KB
4 Dec 2025 6.06 PM
root / root
0644
key_agreement.go
12.354 KB
4 Dec 2025 6.06 PM
root / root
0644
key_schedule.go
3.458 KB
4 Dec 2025 6.06 PM
root / root
0644
prf.go
9.143 KB
4 Dec 2025 6.06 PM
root / root
0644
quic.go
15.06 KB
4 Dec 2025 6.06 PM
root / root
0644
ticket.go
12.627 KB
4 Dec 2025 6.06 PM
root / root
0644
tls.go
12.796 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF