Socket
Socket
Sign inDemoInstall

nirenjan.org/vanity

Package Overview
Dependencies
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nirenjan.org/vanity

Package vanity creates a server to respond to Go package Vanity URLs. It converts the request URL to a VCS URL using a defined algorithm, checks if the target exists, and returns the redirect using the `go-import` meta tags, along with optional `go-source` meta tags. The vanity server serves *insecure* HTTP only, and is intended to be used behind a web server which proxies the requests to the vanity server. The fronting web server is responsible for terminating HTTPS connections.


Version published

Readme

Source

Vanity - a tiny handler for Golang package vanity URLs

GoDoc

Vanity is a small server that handles vanity URLs for Golang packages. It redirects requests of the form /xyz to https://github.com/<user>/xyz, as well as handling the corresponding go-get parameter in the request URL.

It works by sending a GET request to the upstream server, and if found, it will send a 302 redirect back. If the upstream sends back an error message, it will return a 404 error to the client.

In addition, Vanity also supports the creation of go-source meta tags. This allows tools like godoc.org to link to the sources.

Library

Vanity is available as a library to be integrated into an application.

import "nirenjan.org/vanity"

CLI tool

Vanity is also available as a command-line tool that leverages the library.

go get nirenjan.org/vanity/cmd/vanity

CLI arguments

Usage of vanity:
  -base string
        Base URL for vanity server (required)
  -listen-tcp string
        Port to listen on for HTTP server
  -listen-unix string
        Socket to listen on for HTTP server
  -no-query-remote
        Don't query the remote server for repo presence
  -provider string
        VCS Provider
  -redirect string
        Redirect URL for browsers
  -root string
        Root URL for VCS host (required)
  -root-redirect string
        Redirect for requests to base URL
  -vcs string
        VCS type (git, subversion, etc.)
  -web-root string
        Directory containing the .well-known folder (defaults to $PWD)

Example

vanity \
    -base nirenjan.org \
    -root https://github.com/nirenjan/go- \
    -redirect https://godoc.org/nirenjan.org/ \
    -root-redirect https://github.com/nirenjan/?tab=repositories&language=go \
    -provider github

FAQs

Last updated on 15 Nov 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc