mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-22 13:50:49 +01:00
Some parts of the Config struct don't need exporting
This commit is contained in:
parent
da4a9b1040
commit
7b9db3e5f1
2 changed files with 35 additions and 15 deletions
|
@ -4,9 +4,9 @@
|
||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e32960c0-29e5-4669-9fc2-ef12314486ce" name="Changes" comment="Updated CLI usage text to reflect the changes of #27">
|
<list default="true" id="e32960c0-29e5-4669-9fc2-ef12314486ce" name="Changes" comment="Updated README.md and added code-example for programmatic use">
|
||||||
<change afterPath="$PROJECT_DIR$/example-code/simple-password-generator/main.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/config/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/config/config.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -52,6 +52,15 @@
|
||||||
<property name="settings.editor.selected.configurable" value="go.sdk" />
|
<property name="settings.editor.selected.configurable" value="go.sdk" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
|
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
|
||||||
|
<module name="apg-go" />
|
||||||
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
<kind value="PACKAGE" />
|
||||||
|
<package value="apg-go" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<filePath value="$PROJECT_DIR$" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<configuration name="Test Application" type="GoTestRunConfiguration" factoryName="Go Test">
|
<configuration name="Test Application" type="GoTestRunConfiguration" factoryName="Go Test">
|
||||||
<module name="apg-go" />
|
<module name="apg-go" />
|
||||||
<working_directory value="$PROJECT_DIR$" />
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
@ -63,6 +72,16 @@
|
||||||
<framework value="gotest" />
|
<framework value="gotest" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
|
||||||
|
<module name="apg-go" />
|
||||||
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
<kind value="DIRECTORY" />
|
||||||
|
<package value="apg-go" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<filePath value="$PROJECT_DIR$" />
|
||||||
|
<framework value="gotest" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
@ -87,7 +106,8 @@
|
||||||
<MESSAGE value="README.md updated" />
|
<MESSAGE value="README.md updated" />
|
||||||
<MESSAGE value="More README.md updates" />
|
<MESSAGE value="More README.md updates" />
|
||||||
<MESSAGE value="Updated CLI usage text to reflect the changes of #27" />
|
<MESSAGE value="Updated CLI usage text to reflect the changes of #27" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Updated CLI usage text to reflect the changes of #27" />
|
<MESSAGE value="Updated README.md and added code-example for programmatic use" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Updated README.md and added code-example for programmatic use" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<integration-enabled>true</integration-enabled>
|
<integration-enabled>true</integration-enabled>
|
||||||
|
|
|
@ -12,7 +12,7 @@ type Config struct {
|
||||||
MinPassLen int // Minimum password length
|
MinPassLen int // Minimum password length
|
||||||
MaxPassLen int // Maximum password length
|
MaxPassLen int // Maximum password length
|
||||||
NumOfPass int // Number of passwords to be generated
|
NumOfPass int // Number of passwords to be generated
|
||||||
UseComplex bool // Force complex password generation (implies all other Use* Options to be true)
|
useComplex bool // Force complex password generation (implies all other Use* Options to be true)
|
||||||
UseLowerCase bool // Allow lower-case chars in passwords
|
UseLowerCase bool // Allow lower-case chars in passwords
|
||||||
UseUpperCase bool // Allow upper-case chars in password
|
UseUpperCase bool // Allow upper-case chars in password
|
||||||
UseNumber bool // Allow numbers in passwords
|
UseNumber bool // Allow numbers in passwords
|
||||||
|
@ -21,7 +21,7 @@ type Config struct {
|
||||||
CheckHibp bool // Check generated are validated against the HIBP API for possible leaks
|
CheckHibp bool // Check generated are validated against the HIBP API for possible leaks
|
||||||
ExcludeChars string // List of characters to be excluded from the PW generation charset
|
ExcludeChars string // List of characters to be excluded from the PW generation charset
|
||||||
NewStyleModes string // Use the "new style" parameters instead of the single params
|
NewStyleModes string // Use the "new style" parameters instead of the single params
|
||||||
SpellPassword bool // Spell out passwords in the output
|
spellPassword bool // Spell out passwords in the output
|
||||||
ShowHelp bool // Display the help message in the CLI
|
ShowHelp bool // Display the help message in the CLI
|
||||||
ShowVersion bool // Display the version string in the CLI
|
ShowVersion bool // Display the version string in the CLI
|
||||||
OutputMode int // Interal parameter to control the output mode of the CLI
|
OutputMode int // Interal parameter to control the output mode of the CLI
|
||||||
|
@ -46,7 +46,7 @@ func New() Config {
|
||||||
UseUpperCase: true,
|
UseUpperCase: true,
|
||||||
UseNumber: true,
|
UseNumber: true,
|
||||||
UseSpecial: false,
|
UseSpecial: false,
|
||||||
UseComplex: false,
|
useComplex: false,
|
||||||
HumanReadable: false,
|
HumanReadable: false,
|
||||||
}
|
}
|
||||||
config := Config{
|
config := Config{
|
||||||
|
@ -54,7 +54,7 @@ func New() Config {
|
||||||
UseUpperCase: defaultSwitches.UseUpperCase,
|
UseUpperCase: defaultSwitches.UseUpperCase,
|
||||||
UseNumber: defaultSwitches.UseNumber,
|
UseNumber: defaultSwitches.UseNumber,
|
||||||
UseSpecial: defaultSwitches.UseSpecial,
|
UseSpecial: defaultSwitches.UseSpecial,
|
||||||
UseComplex: defaultSwitches.UseComplex,
|
useComplex: defaultSwitches.useComplex,
|
||||||
HumanReadable: defaultSwitches.HumanReadable,
|
HumanReadable: defaultSwitches.HumanReadable,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ func New() Config {
|
||||||
flag.BoolVar(&switchConf.UseUpperCase, "U", false, "Use upper case characters in passwords")
|
flag.BoolVar(&switchConf.UseUpperCase, "U", false, "Use upper case characters in passwords")
|
||||||
flag.BoolVar(&switchConf.UseNumber, "N", false, "Use numerich characters in passwords")
|
flag.BoolVar(&switchConf.UseNumber, "N", false, "Use numerich characters in passwords")
|
||||||
flag.BoolVar(&switchConf.UseSpecial, "S", false, "Use special characters in passwords")
|
flag.BoolVar(&switchConf.UseSpecial, "S", false, "Use special characters in passwords")
|
||||||
flag.BoolVar(&switchConf.UseComplex, "C", false, "Generate complex passwords (implies -L -U -N -S, disables -H)")
|
flag.BoolVar(&switchConf.useComplex, "C", false, "Generate complex passwords (implies -L -U -N -S, disables -H)")
|
||||||
flag.BoolVar(&switchConf.HumanReadable, "H", false, "Generate human-readable passwords")
|
flag.BoolVar(&switchConf.HumanReadable, "H", false, "Generate human-readable passwords")
|
||||||
flag.BoolVar(&config.SpellPassword, "l", false, "Spell generated password")
|
flag.BoolVar(&config.spellPassword, "l", false, "Spell generated password")
|
||||||
flag.BoolVar(&config.CheckHibp, "p", false, "Check the HIBP database if the generated password was leaked before")
|
flag.BoolVar(&config.CheckHibp, "p", false, "Check the HIBP database if the generated password was leaked before")
|
||||||
flag.BoolVar(&config.ShowVersion, "v", false, "Show version")
|
flag.BoolVar(&config.ShowVersion, "v", false, "Show version")
|
||||||
flag.IntVar(&config.MinPassLen, "m", DefaultMinLength, "Minimum password length")
|
flag.IntVar(&config.MinPassLen, "m", DefaultMinLength, "Minimum password length")
|
||||||
|
@ -91,8 +91,8 @@ func New() Config {
|
||||||
if switchConf.UseSpecial {
|
if switchConf.UseSpecial {
|
||||||
config.UseSpecial = !defaultSwitches.UseSpecial
|
config.UseSpecial = !defaultSwitches.UseSpecial
|
||||||
}
|
}
|
||||||
if switchConf.UseComplex {
|
if switchConf.useComplex {
|
||||||
config.UseComplex = !defaultSwitches.UseComplex
|
config.useComplex = !defaultSwitches.useComplex
|
||||||
}
|
}
|
||||||
if switchConf.HumanReadable {
|
if switchConf.HumanReadable {
|
||||||
config.HumanReadable = !defaultSwitches.HumanReadable
|
config.HumanReadable = !defaultSwitches.HumanReadable
|
||||||
|
@ -109,7 +109,7 @@ func parseParams(config *Config) {
|
||||||
parseNewStyleParams(config)
|
parseNewStyleParams(config)
|
||||||
|
|
||||||
// Complex overrides everything
|
// Complex overrides everything
|
||||||
if config.UseComplex {
|
if config.useComplex {
|
||||||
config.UseUpperCase = true
|
config.UseUpperCase = true
|
||||||
config.UseLowerCase = true
|
config.UseLowerCase = true
|
||||||
config.UseSpecial = true
|
config.UseSpecial = true
|
||||||
|
@ -130,7 +130,7 @@ func parseParams(config *Config) {
|
||||||
config.OutputMode = 2
|
config.OutputMode = 2
|
||||||
default:
|
default:
|
||||||
config.OutputMode = 0
|
config.OutputMode = 0
|
||||||
if config.SpellPassword {
|
if config.spellPassword {
|
||||||
config.OutputMode = 1
|
config.OutputMode = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,9 +165,9 @@ func parseNewStyleParams(config *Config) {
|
||||||
case 'h':
|
case 'h':
|
||||||
config.HumanReadable = false
|
config.HumanReadable = false
|
||||||
case 'C':
|
case 'C':
|
||||||
config.UseComplex = true
|
config.useComplex = true
|
||||||
case 'c':
|
case 'c':
|
||||||
config.UseComplex = false
|
config.useComplex = false
|
||||||
default:
|
default:
|
||||||
log.Fatalf("Unknown password style parameter: %q\n", string(curParam))
|
log.Fatalf("Unknown password style parameter: %q\n", string(curParam))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue