kkn.fi/vanity
Concepts
- VCS is Version Control System (such as
gitorhg)- Repo root is the root path the source code repository (such as "https://github.com/kare")
- Domain is the internet address where the Go Vanity server is hosted (such as 9fans.net or kkn.fi). Domain is deduced from HTTP request or can be set as a parameter.
- Path is the path component of the Go package (such as
/cmd/tcpproxyinkkn.fi/cmd/tcpproxy)
Specification
Features
- Zero dependencies.
- Redirects Go tool to VCS.
- Redirects browsers to pkg.go.dev module server by default. Module Server URL is configurable.
- Automatic configuration of cmd packages:
- All packages are redirected without sub-packages to VCS root.
- Packages whose path is prefixed with
/cmd/redirect automatically to VCS root by stripping the/cmdprefix from the package path. - Examples:
- Redirect request
kkn.fi/cmd/tcpproxytogithub.com/kare/tcpproxy - Redirect request
kkn.fi/project/sub/packagetogithub.com/kare/project
- Redirect request
Vanity configurable options
Vanity package supports configurable Options via the constructor. Use Option types to configure vanity handler features. Basic Options are documented below:
- Set Version Control System type.
- Configurable Version Control System HTTP URL
- Module server URL options are:
- Vanity server domain name defaults to request hostname, but it can also be configured.
- Configurable Logger which is compatible with the standard log.Logger. Default output goes to standard error.
- Configurable static content directory for images, CSS, and etc.
- Configurable IndexPageHandler. Defaults to index.html file in the static content directory root.
- Configurable robots.txt file.
Installation
go get kkn.fi/vanity
Development
New features or bug fixes must include comprehensive unit tests.
Bugs
- Search GitHub Issues for existing bugs or open a new issue to report a new bug.
- To fix an existing bug from GitHub Issues open a new GitHub Pull Request.
Building new features
- Open a new GitHub Issue to discuss or propose a new feature.
- Open a new Pull Request for a new feature that has beed already discussed.
Execute compiler, tests and tools
Use Makefile to execute Go compiler, tests and tools.
Run all tests
make test
Execute short (unit) running tests
make test-unit
Execute long (integration) running tests
make test-integration
Run goimports
make goimports
Run staticcheck
make staticcheck
Run gofmt with simplify
make fmt