Changeset 137 in code


Ignore:
Timestamp:
Mar 28, 2021, 12:28:03 AM (4 years ago)
Author:
asciimoo
Message:

[fix] read cli flags properly - fixes #96 fixes #101

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/morty.go

    r136 r137  
    10551055
    10561056func main() {
    1057         cfg.ListenAddress = *flag.String("listen", cfg.ListenAddress, "Listen address")
    1058         cfg.Key = *flag.String("key", cfg.Key, "HMAC url validation key (base64 encoded) - leave blank to disable validation")
    1059         cfg.Debug = *flag.Bool("debug", cfg.Debug, "Debug mode")
    1060         cfg.RequestTimeout = *flag.Uint("timeout", cfg.RequestTimeout, "Request timeout")
    1061         cfg.FollowRedirect = *flag.Bool("followredirect", cfg.FollowRedirect, "Follow HTTP GET redirect")
     1057        listenAddress := flag.String("listen", cfg.ListenAddress, "Listen address")
     1058        key := flag.String("key", cfg.Key, "HMAC url validation key (base64 encoded) - leave blank to disable validation")
     1059        IPV6 := flag.Bool("ipv6", cfg.IPV6, "Allow IPv6 HTTP requests")
     1060        debug := flag.Bool("debug", cfg.Debug, "Debug mode")
     1061        requestTimeout := flag.Uint("timeout", cfg.RequestTimeout, "Request timeout")
     1062        followRedirect := flag.Bool("followredirect", cfg.FollowRedirect, "Follow HTTP GET redirect")
    10621063        proxyenv := flag.Bool("proxyenv", false, "Use a HTTP proxy as set in the environment (HTTP_PROXY, HTTPS_PROXY and NO_PROXY). Overrides -proxy, -socks5, -ipv6.")
    10631064        proxy := flag.String("proxy", "", "Use the specified HTTP proxy (ie: '[user:pass@]hostname:port'). Overrides -socks5, -ipv6.")
    10641065        socks5 := flag.String("socks5", "", "Use a SOCKS5 proxy (ie: 'hostname:port'). Overrides -ipv6.")
    1065         cfg.IPV6 = *flag.Bool("ipv6", cfg.IPV6, "Use IPv6 and IPv4 to send HTTP requests.")
    10661066        version := flag.Bool("version", false, "Show version")
    10671067        flag.Parse()
     1068
     1069        cfg.ListenAddress = *listenAddress
     1070        cfg.Key = *key
     1071        cfg.IPV6 = *IPV6
     1072        cfg.Debug = *debug
     1073        cfg.RequestTimeout = *requestTimeout
     1074        cfg.FollowRedirect = *followRedirect
    10681075
    10691076        if *version {
Note: See TracChangeset for help on using the changeset viewer.