mirror of
				https://github.com/minio/minio.git
				synced 2025-10-29 15:55:00 -04:00 
			
		
		
		
	Use custom transport for remote targets (#12080)
This commit is contained in:
		
							parent
							
								
									7a0a5bdc0d
								
							
						
					
					
						commit
						c9bf6007b4
					
				| @ -363,7 +363,7 @@ func (sys *BucketTargetSys) getRemoteTargetClient(tcfg *madmin.BucketTarget) (*T | ||||
| 	creds := credentials.NewStaticV4(config.AccessKey, config.SecretKey, "") | ||||
| 
 | ||||
| 	getRemoteTargetInstanceTransportOnce.Do(func() { | ||||
| 		getRemoteTargetInstanceTransport = newGatewayHTTPTransport(10 * time.Minute) | ||||
| 		getRemoteTargetInstanceTransport = NewRemoteTargetHTTPTransport() | ||||
| 	}) | ||||
| 	api, err := minio.New(tcfg.Endpoint, &miniogo.Options{ | ||||
| 		Creds:     creds, | ||||
|  | ||||
							
								
								
									
										29
									
								
								cmd/utils.go
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								cmd/utils.go
									
									
									
									
									
								
							| @ -26,6 +26,7 @@ import ( | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| 	"net" | ||||
| 	"net/http" | ||||
| 	"net/url" | ||||
| 	"os" | ||||
| @ -637,6 +638,34 @@ func newGatewayHTTPTransport(timeout time.Duration) *http.Transport { | ||||
| 	return tr | ||||
| } | ||||
| 
 | ||||
| // NewRemoteTargetHTTPTransport returns a new http configuration | ||||
| // used while communicating with the remote replication targets. | ||||
| func NewRemoteTargetHTTPTransport() *http.Transport { | ||||
| 	// For more details about various values used here refer | ||||
| 	// https://golang.org/pkg/net/http/#Transport documentation | ||||
| 	tr := &http.Transport{ | ||||
| 		Proxy: http.ProxyFromEnvironment, | ||||
| 		DialContext: (&net.Dialer{ | ||||
| 			Timeout:   15 * time.Second, | ||||
| 			KeepAlive: 30 * time.Second, | ||||
| 		}).DialContext, | ||||
| 		MaxIdleConnsPerHost:   1024, | ||||
| 		WriteBufferSize:       16 << 10, // 16KiB moving up from 4KiB default | ||||
| 		ReadBufferSize:        16 << 10, // 16KiB moving up from 4KiB default | ||||
| 		IdleConnTimeout:       15 * time.Second, | ||||
| 		TLSHandshakeTimeout:   5 * time.Second, | ||||
| 		ExpectContinueTimeout: 5 * time.Second, | ||||
| 		TLSClientConfig: &tls.Config{ | ||||
| 			RootCAs: globalRootCAs, | ||||
| 		}, | ||||
| 		// Go net/http automatically unzip if content-type is | ||||
| 		// gzip disable this feature, as we are always interested | ||||
| 		// in raw stream. | ||||
| 		DisableCompression: true, | ||||
| 	} | ||||
| 	return tr | ||||
| } | ||||
| 
 | ||||
| // Load the json (typically from disk file). | ||||
| func jsonLoad(r io.ReadSeeker, data interface{}) error { | ||||
| 	if _, err := r.Seek(0, io.SeekStart); err != nil { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user