-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Ma3oBblu/travis
add travis config, readme, license
- Loading branch information
Showing
6 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
.idea | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: go | ||
go: | ||
- "1.16" | ||
|
||
env: | ||
- env GO111MODULE=on | ||
|
||
script: | ||
- go mod vendor | ||
- go test -v -race -coverprofile=coverage.txt -covermode=atomic | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 White Chang | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module masker | ||
|
||
go 1.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,65 @@ | ||
# masker for sensitive information | ||
# Masker | ||
|
||
[![Build Status](https://travis-ci.org/ma3obblu/masker.svg?branch=master)](https://travis-ci.org/ma3obblu/masker) | ||
[![codecov](https://codecov.io/gh/ma3obblu/masker/branch/master/graph/badge.svg)](https://codecov.io/gh/ma3obblu/masker) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/ma3obblu/masker)](https://goreportcard.com/report/github.com/ma3obblu/masker) | ||
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ma3obblu/masker/blob/master/LICENSE) | ||
[![GoDoc](https://godoc.org/github.com/ma3obblu/masker?status.svg)](https://godoc.org/github.com/ma3obblu/masker) | ||
[![Release](https://img.shields.io/github/release/ma3obblu/masker.svg?style=flat-square)](https://github.com/ma3obblu/masker/releases/latest) | ||
|
||
Masker простая утилита для маскировки чувствительных данных. | ||
|
||
# Установка | ||
|
||
``` | ||
$ go get -u github.com/ma3obblu/masker | ||
``` | ||
|
||
# Примеры | ||
|
||
Два способа работы с masker: | ||
|
||
#### 1. Получить инстанс напрямую из пакета masker | ||
|
||
``` golang | ||
package main | ||
|
||
import ( | ||
masker "github.com/ma3obblu/masker" | ||
) | ||
|
||
func main() { | ||
masker.Name("Руслан") | ||
masker.Mobile("79191232323") | ||
} | ||
``` | ||
|
||
#### 2. Получить инстанс используя конструктор `masker.New()` | ||
|
||
``` golang | ||
package main | ||
|
||
import ( | ||
masker "github.com/ma3obblu/masker" | ||
) | ||
|
||
func main() { | ||
m := masker.New() | ||
m.Name("Руслан") | ||
m.Mobile("79191232323") | ||
} | ||
``` | ||
|
||
## Типы полей | ||
|
||
|Type |Description | | ||
|:----------:|:------------------------------------------------------------------------------------------------------| | ||
|Name|маскирует второй и третий символ в строке. Может работать со строками из нескольких слов| | | ||
|CreditCard|маскирует 6 символов номера кредитной карты начиная с 7| | ||
|Email|маскирует логин в email, оставляя домен| | ||
|Mobile|маскирует 11 значный номер телефона с ведущей цифрой 7, оставляет первые 4 и последние 2 цифры| | ||
|Password|всегда вернет "************"| | ||
|PassportSeries|маскирует серию паспорта, оставляя первую и последнюю цифры| | ||
|PassportNumber|маскирует номер паспорта, оставляя первую и последнюю цифру| | ||
|Code|маскирует код из цифр. Для кодов состоящих из меньше чем 4 символов, оставляет первый символ. Для кодов большей длины оставляет первый и последний символ| | ||
|LastFourDigits|маскирует любую последовательность больше 5 символов, оставляя 4 последних символа| |