maskpass

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 1 Imported by: 1

README

maskpass

maskpass will mask a given string with xxxxxx, this is specially useful to hide passwords on logs.

Simple usage:

package main

import (
  "fmt"
  "github.com/nrxr/maskpass"
)

func main() {
  uri := "https://user:password@localhost:port/path"
  fmt.Println(maskpass.String(uri))
  // Output: "https://user:xxxxxx@localhost:port/path"
}

Full docs on https://godoc.org/github.com/nrxr/maskpass

License

ⓒ 2019, nrxr <nrxr@disroot.org>. Released under the MIT license terms.

Documentation

Overview

Package maskpass masks the password of an URL, so something like https://user:password@host:port/ would end up like https://user:xxxxxx@host:port/.

Usage:

The easiest way to use maskpass is with the method String.

uri := url.Parse("whatever")
masked := maskpass.String(uri.String())

Index

Constants

View Source
const MASK = "xxxxxx"

Variables

This section is empty.

Functions

func Mask

func Mask(uri string) (*url.URL, error)

Mask returns an *url.URL with the password masked to the placeholder constant's value.

func String

func String(uri string) string

String returns a masked url.URL.String() without error handling. It's a wrapper of String().

func StringError

func StringError(uri string) (string, error)

StringError returns the url.URL.String() value and an error if something went wrong calling Mask.

Types

This section is empty.

Jump to

Keyboard shortcuts

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