desensitize

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-08-03 22:19:05 * @FilePath: \go-toolbox\pkg\desensitize\constants.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-01 22:23:03 * @FilePath: \go-toolbox\pkg\desensitize\model.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Desensitize

func Desensitize(str string, DesensitizeType DesensitizeType, options ...DesensitizeOptions) string

Desensitize 数据脱敏

func SensitiveData

func SensitiveData(str string, start, end int) string

通用脱敏函数

func SensitizeBankCard

func SensitizeBankCard(str string, cardLength int) string

银行卡号脱敏

func SensitizeCarLicense

func SensitizeCarLicense(str string) string

车牌号脱敏

func SensitizeIpv4

func SensitizeIpv4(str string) string

ipv4 脱敏

func SensitizeIpv6

func SensitizeIpv6(str string) string

ipv6 脱敏

func SensitizePhoneNumber

func SensitizePhoneNumber(str string, start, end int) string

手机号脱敏

Types

type DesensitizeOptions

type DesensitizeOptions struct {
	CustomExtensionStartIndex int
	CustomExtensionEndIndex   int
	ChineseNameStartIndex     int
	ChineseNameEndIndex       int
	IdCardStartIndex          int
	IdCardEndIndex            int
	IdCardLength              int
	PhoneNumberStartIndex     int
	PhoneNumberEndIndex       int
	MobilePhoneStartIndex     int
	EmailStartIndex           int
	AddressLength             int
}

DesensitizeOptions 脱敏选项

func NewDesensitizeOptions

func NewDesensitizeOptions() DesensitizeOptions

NewDesensitizeOptions 创建带有默认值的 DesensitizeOptions

type DesensitizeType

type DesensitizeType int
const (
	CustomExtension DesensitizeType = iota + 1 // 自定义扩展
	ChineseName                                // 中文名称
	IDCard                                     // 身份证号
	PhoneNumber                                // 手机号码
	MobilePhone                                // 移动电话号码
	Address                                    // 地址
	Email                                      // 邮箱
	Password                                   // 密码
	CarLicense                                 // 车牌号:油车、电车
	BankCard                                   // 银行卡号
	IPV4                                       // ipv4
	IPV6                                       // ipv6
)

Jump to

Keyboard shortcuts

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