| 1234567891011121314151617181920212223242526272829303132 |
- package service
- import (
- "net/http"
- "one-api/common"
- "time"
- )
- var httpClient *http.Client
- var impatientHTTPClient *http.Client
- func init() {
- if common.RelayTimeout == 0 {
- httpClient = &http.Client{}
- } else {
- httpClient = &http.Client{
- Timeout: time.Duration(common.RelayTimeout) * time.Second,
- }
- }
- impatientHTTPClient = &http.Client{
- Timeout: 5 * time.Second,
- }
- }
- func GetHttpClient() *http.Client {
- return httpClient
- }
- func GetImpatientHttpClient() *http.Client {
- return impatientHTTPClient
- }
|