proxy

package module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 16 Imported by: 0

README

github-proxy

github-proxy is a proxy that can archive any directory in the specified GitHub repository tree and deliver it via HTTP.

Installation

$ go get -u github.com/mitene/github-proxy

Usage

$ github-proxy [options]

The command starts the HTTP server.

Command option
Parameter Description Default
-port HTTP server port 8080

Endpoint

repo

Download starts after compressing the specified repository path.

/repo/{owner}/{repository}
GET params
Parameter Description Default
ref git commit hash or branch name master
type archive formats. supported zip, tgz, tar,gz tgz
path path in GitHub repository /
Example to get
$ wget --content-disposition "http://localhost:8080/repo/mitene/github-proxy?path=cmd"

This gets cmd directory of mitene repository in the form of tgz file.

Rules for downloaded file name

Owner-Repository-Ref.Type

Example

mitene-github-proxy-master.tgz

Working with private repositories

Set personal access token in environment variable GITHUB_TOKEN.

License

The source code is licensed MIT.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(port int) error

func RepoHandler added in v0.0.3

func RepoHandler(w http.ResponseWriter, r *http.Request)

Types

type GithubClient

type GithubClient interface {
	MakeArchive(owner string, repo string, ref string, repoPath string, dest string, ext string) (string, error)
}

func NewGithubClient

func NewGithubClient() GithubClient

type GithubClientImpl

type GithubClientImpl struct {
	// contains filtered or unexported fields
}

func (*GithubClientImpl) MakeArchive

func (c *GithubClientImpl) MakeArchive(owner string, repo string, ref string, repoPath string, dest string, ext string) (string, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL