code.gitea.io/gitea@v1.21.7/services/migrations/http_client.go (about)

     1  // Copyright 2021 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package migrations
     5  
     6  import (
     7  	"crypto/tls"
     8  	"net/http"
     9  
    10  	"code.gitea.io/gitea/modules/hostmatcher"
    11  	"code.gitea.io/gitea/modules/proxy"
    12  	"code.gitea.io/gitea/modules/setting"
    13  )
    14  
    15  // NewMigrationHTTPClient returns a HTTP client for migration
    16  func NewMigrationHTTPClient() *http.Client {
    17  	return &http.Client{
    18  		Transport: NewMigrationHTTPTransport(),
    19  	}
    20  }
    21  
    22  // NewMigrationHTTPTransport returns a HTTP transport for migration
    23  func NewMigrationHTTPTransport() *http.Transport {
    24  	return &http.Transport{
    25  		TLSClientConfig: &tls.Config{InsecureSkipVerify: setting.Migrations.SkipTLSVerify},
    26  		Proxy:           proxy.Proxy(),
    27  		DialContext:     hostmatcher.NewDialContext("migration", allowList, blockList),
    28  	}
    29  }