Skip to content

Commit

Permalink
cmd: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Aug 30, 2024
1 parent 4b09664 commit 2f59748
Show file tree
Hide file tree
Showing 6 changed files with 706 additions and 706 deletions.
6 changes: 3 additions & 3 deletions internal/cmd/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ var commandLineOptions = []*commandLineOption{
}

// parseCmdLineOptions parses the command-line options. opts must not be nil.
func parseCmdLineOptions(opts *Options) (err error) {
func parseCmdLineOptions(opts *configuration) (err error) {
cmdName, args := os.Args[0], os.Args[1:]

flags := flag.NewFlagSet(cmdName, flag.ContinueOnError)
Expand Down Expand Up @@ -493,7 +493,7 @@ func writeUsageLine(b *strings.Builder, o *commandLineOption) {

// processCmdLineOptions decides if dnsproxy should exit depending on the
// results of command-line option parsing.
func processCmdLineOptions(opts *Options, parseErr error) (exitCode int, needExit bool) {
func processCmdLineOptions(opts *configuration, parseErr error) (exitCode int, needExit bool) {
if parseErr != nil {
// Assume that usage has already been printed.
return osutil.ExitCodeArgumentError, true
Expand All @@ -515,7 +515,7 @@ func processCmdLineOptions(opts *Options, parseErr error) (exitCode int, needExi
}

// mapOptions returns options mapped with commandLineOptions.
func mapOptions(opts *Options) map[int]any {
func mapOptions(opts *configuration) map[int]any {
return map[int]any{
configPathIdx: &opts.ConfigPath,
logOutputIdx: &opts.LogOutput,
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// Main is the entrypoint of dnsproxy CLI. Main may accept arguments, such as
// embedded assets and command-line arguments.
func Main() {
opts, exitCode, err := parseOptions()
opts, exitCode, err := parseConfig()
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, fmt.Errorf("parsing options: %w", err))
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func Main() {
// runProxy starts and runs the proxy. l must not be nil.
//
// TODO(e.burkov): Move into separate dnssvc package.
func runProxy(ctx context.Context, l *slog.Logger, options *Options) (err error) {
func runProxy(ctx context.Context, l *slog.Logger, options *configuration) (err error) {
var (
buildVersion = version.Version()
revision = version.Revision()
Expand Down
Loading

0 comments on commit 2f59748

Please sign in to comment.