Source File
altsvc.go
Belonging Package
github.com/imroc/req/v3/pkg/altsvc
package altsvcimport ()// AltSvcJar is default implementation of Jar, which stores// AltSvc in memory.type AltSvcJar struct {entries map[string]*AltSvcmu sync.Mutex}// NewAltSvcJar create a AltSvcJar which implements Jar.func () *AltSvcJar {return &AltSvcJar{entries: make(map[string]*AltSvc),}}func ( *AltSvcJar) ( string) *AltSvc {if == "" {return nil}, := .entries[]if ! {return nil}:= time.Now().mu.Lock()defer .mu.Unlock()if .Expire.Before() { // expireddelete(.entries, )return nil}return}func ( *AltSvcJar) ( string, *AltSvc) {if == "" {return}.mu.Lock()defer .mu.Unlock().entries[] =}// AltSvc is the parsed alt-svc.type AltSvc struct {// Protocol is the alt-svc proto, e.g. h3.Protocol string// Host is the alt-svc's host, could be empty if// it's the same host as the raw request.Host string// Port is the alt-svc's port.Port string// Expire is the time that the alt-svc should expire.Expire time.Time}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |