github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/vcweb/vcstest/vcstest.go (about)

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package vcstest serves the repository scripts in cmd/go/testdata/vcstest
     6  // using the [vcweb] script engine.
     7  package vcstest
     8  
     9  import (
    10  	"github.com/shogo82148/std/cmd/go/internal/vcweb"
    11  	"github.com/shogo82148/std/net/http"
    12  	"github.com/shogo82148/std/net/http/httptest"
    13  )
    14  
    15  var Hosts = []string{
    16  	"vcs-test.golang.org",
    17  }
    18  
    19  type Server struct {
    20  	vcweb   *vcweb.Server
    21  	workDir string
    22  	HTTP    *httptest.Server
    23  	HTTPS   *httptest.Server
    24  }
    25  
    26  // NewServer returns a new test-local vcweb server that serves VCS requests
    27  // for modules with paths that begin with "vcs-test.golang.org" using the
    28  // scripts in cmd/go/testdata/vcstest.
    29  func NewServer() (srv *Server, err error)
    30  
    31  func (srv *Server) Close() error
    32  
    33  func (srv *Server) WriteCertificateFile() (string, error)
    34  
    35  // TLSClient returns an http.Client that can talk to the httptest.Server
    36  // whose certificate is written to the given file path.
    37  func TLSClient(certFile string) (*http.Client, error)