Documentation
¶
Overview ¶
simpleconffile package
This is not the intended to be a high class way of storing off a config file, let alone encrypt the contents. However, for simple tools, it is a great lift.
Allows one to quickly write a struct into a conf file and read back.
Also if wanted - encrypt strings so a someone cannot read them in the exported conf file
Index ¶
- type SimpleConfFile
- func (pS *SimpleConfFile) DecryptString(cryptoText string) string
- func (pS *SimpleConfFile) Dump()
- func (pS *SimpleConfFile) EncryptString(text string) string
- func (pS *SimpleConfFile) GetEncryptKey() []byte
- func (pS *SimpleConfFile) ReadConf(v interface{}) bool
- func (pS *SimpleConfFile) SaveConf(v interface{}) bool
- func (pS *SimpleConfFile) SetEncryptKey(input string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleConfFile ¶
type SimpleConfFile struct {
ByteEncryptKey []byte // holds the key for the crypto work
Filename string // name of the file to write/read
}
func New ¶
func New(keystring string, confname string) *SimpleConfFile
func (*SimpleConfFile) DecryptString ¶
func (pS *SimpleConfFile) DecryptString(cryptoText string) string
DecryptString() - Decrypts a string
text - string to decrypt
addapted from https://gist.github.com/manishtpatel/8222606
encrypt string to base64 crypto using AES
func (*SimpleConfFile) Dump ¶
func (pS *SimpleConfFile) Dump()
func (*SimpleConfFile) EncryptString ¶
func (pS *SimpleConfFile) EncryptString(text string) string
func (*SimpleConfFile) GetEncryptKey ¶
func (pS *SimpleConfFile) GetEncryptKey() []byte
func (*SimpleConfFile) ReadConf ¶
func (pS *SimpleConfFile) ReadConf(v interface{}) bool
func (*SimpleConfFile) SaveConf ¶
func (pS *SimpleConfFile) SaveConf(v interface{}) bool
func (*SimpleConfFile) SetEncryptKey ¶
func (pS *SimpleConfFile) SetEncryptKey(input string)
Click to show internal directories.
Click to hide internal directories.