/uriban

Golang package for hiding information in a URI

Primary LanguageGoMIT LicenseMIT

uriban

Build Status Coverage Status GoDoc

Description

Golang package for hiding information in a URI

Installation

This package can be installed with the go get command:

go get github.com/arteev/uriban

Documentation

Example:

package main

import (
	"flag"
	"log"

	"github.com/arteev/uriban"
)

var connectionString = flag.String("connection", "postgres://pqgotest:password@myhost/pqgotest?sslmode=verify-full", "connection string")

func main() {
	flag.Parse()
	bs := uriban.Replace(*connectionString,
		uriban.WithOption(uriban.Password, uriban.ModeValue("SECRET")),
		uriban.WithOption(uriban.Host, uriban.ModeValue("localhost")))
	log.Printf("Connection string: %s", bs)
}

Output:

2017/10/11 13:54:14 Connection string: postgres://pqgotest:SECRET@localhost/pqgotest?sslmode=verify-full

License

MIT

Author

Arteev Aleksey