Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

nrxr/maskpass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maskpass

DEPRECATED: Please, use net/url's URL.Redacted instead.

https://pkg.go.dev/net/url#URL.Redacted


This package masks passwords from URL strings making them log-friendly.

Even if you're using url.URL structures instead of plain strings, this is very useful, you just need to pass the url.URL.String() value and maskpass will take care of it.

It will only mask the URL if there's a password in the URL, otherwise it will just output the same thing url.URL.String() would.

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.

About

Make URLs log-friendly by masking passwords

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages