本文整理汇总了Golang中flag.Int64Var函数的典型用法代码示例。如果您正苦于以下问题:Golang Int64Var函数的具体用法?Golang Int64Var怎么用?Golang Int64Var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Int64Var函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
    laddr := flag.String("listen", ":8001", "listen address")
    baddr := flag.String("backend", "127.0.0.1:1234", "backend address")
    secret := flag.String("secret", "the answer to life, the universe and everything", "tunnel secret")
    tunnels := flag.Uint("tunnels", 1, "low level tunnel count, 0 if work as server")
    flag.Int64Var(&tunnel.Timeout, "timeout", 10, "tunnel read/write timeout")
    flag.UintVar(&tunnel.LogLevel, "log", 1, "log level")

    flag.Usage = usage
    flag.Parse()

    app := &tunnel.App{
        Listen:  *laddr,
        Backend: *baddr,
        Secret:  *secret,
        Tunnels: *tunnels,
    }
    err := app.Start()
    if err != nil {
        fmt.Fprintf(os.Stderr, "start failed:%s\n", err.Error())
        return
    }
    go handleSignal(app)

    app.Wait()
}

开发者ID:xiaobodu,项目名称:gotunnel,代码行数:26,代码来源:main.go

示例2: main

func main() {
    var options Options

    flag.Var(&options.SourceDirs, "folder", "The folder to inspect for documents, can be provided multiple times")
    flag.StringVar(&options.Agency, "agency", "", "The agency to use if it's not available in the folder structure")
    flag.StringVar(&options.Component, "component", "", "The component to use if it's not available in the folder structure")
    flag.StringVar(&options.HtmlReport, "report", "report.html", "The file in which to store the HTML report")
    flag.StringVar(&options.PhpDataFile, "phpDataFile", "", "The file in which to store the file information as PHP data")
    flag.StringVar(&options.PhpVarName, "phpVarName", "$FILES", "The PHP variable to assign the file data to")
    flag.BoolVar(&options.WarnOnMissingAgency, "warnOnMissingAgency", false, "Should we warn if a agency is missing from folder structure?")
    flag.BoolVar(&options.WarnOnMissingComponent, "warnOnMissingComponent", false, "Should we warn if a component is missing from folder structure?")
    flag.Int64Var(&options.ErrorSingleFileSizeBytes, "errorSingleFileSizeBytes", 1024*500, "Display an error for any files larger than this size")
    flag.Int64Var(&options.WarnAverageFileSizeBytes, "warnAverageFileSizeBytes", 1024*384, "Display a warning if average size of files in the download exceeds this threshold")

    //options.SourceDirs.Set("C:\\Projects\\MAX-OGE\\docs-generator\\generated-files")
    options.Extensions = map[string]bool{".pdf": true}
    options.FieldsSeparator = ';'

    if options.validate() {
        var results Results
        results.Options = options
        results.walkSourceDirs()
        fmt.Println(results.LastFileIndex, "documents found in", len(results.DirsWalked), "folders.")
        results.createReport("HTML Report", htmlReportTemplate, options.HtmlReport)
        if len(options.PhpDataFile) > 0 {
            results.createReport("PHP Data", phpDataTemplate, options.PhpDataFile)
        }
    }
}

开发者ID:shah,项目名称:docs-admin,代码行数:29,代码来源:docs-admin.go

示例3: main

func main() {
    flag.StringVar(&target.Address, "a", "", "address of sink")
    flag.Int64Var(&target.Counter, "c", 0, "initial packet counter")
    flag.Int64Var(&target.Next, "t", 0, "initial update timestamp")
    keyFile := flag.String("k", "decrypt.pub", "sink's decryption public key")
    flag.Parse()

    if target.Address == "" {
        fmt.Fprintf(os.Stderr, "[!] no address provided.\n")
        os.Exit(1)
    }

    in, err := ioutil.ReadFile(*keyFile)
    checkError(err)

    if len(in) != 32 {
        fmt.Fprintf(os.Stderr, "[!] invalid Curve25519 public key.\n")
    }

    target.Public = in
    buf := &bytes.Buffer{}
    out, err := json.Marshal(target)
    checkError(err)

    err = json.Indent(buf, out, "", "\t")
    checkError(err)

    fmt.Printf("%s\n", buf.Bytes())

}

开发者ID:postfix,项目名称:entropyshare,代码行数:30,代码来源:target.go

示例4: init

func init() {
    flag.Int64Var(&first, "first", 0, "first uid")
    flag.Int64Var(&last, "last", 0, "last uid")
    flag.StringVar(&local_ip, "local_ip", "0.0.0.0", "local ip")
    flag.StringVar(&host, "host", "127.0.0.1", "host")
    flag.IntVar(&port, "port", 23000, "port")
}

开发者ID:ZhangTingkuo,项目名称:im_service,代码行数:7,代码来源:benchmark_connection.go

示例5: main

func main() {

    var (
        S_SERVERS       string
        S_LISTEN        string
        S_ACCESS        string
        timeout         int
        max_entries     int64
        expire_interval int64
    )

    flag.StringVar(&S_SERVERS, "proxy", "127.0.0.1:53", "we proxy requests to those servers")
    flag.StringVar(&S_LISTEN, "listen", "[::1]:5353,127.0.0.1:5353",
        "listen on (both tcp and udp), [ipv6address]:port, ipv4address:port")
    flag.StringVar(&S_ACCESS, "access", "0.0.0.0/0", "allow those networks, use 0.0.0.0/0 to allow everything")
    flag.IntVar(&timeout, "timeout", 5, "timeout")
    flag.Int64Var(&expire_interval, "expire_interval", 300, "delete expired entries every N seconds")
    flag.BoolVar(&DEBUG, "debug", false, "enable/disable debug")
    flag.Int64Var(&max_entries, "max_cache_entries", 2000000, "max cache entries")

    flag.Parse()
    servers := strings.Split(S_SERVERS, ",")
    proxyer := ServerProxy{
        giant:       new(sync.RWMutex),
        ACCESS:      make([]*net.IPNet, 0),
        SERVERS:     servers,
        s_len:       len(servers),
        NOW:         time.Now().UTC().Unix(),
        entries:     0,
        timeout:     time.Duration(timeout) * time.Second,
        max_entries: max_entries}

    for _, mask := range strings.Split(S_ACCESS, ",") {
        _, cidr, err := net.ParseCIDR(mask)
        if err != nil {
            panic(err)
        }
        _D("added access for %s\n", mask)
        proxyer.ACCESS = append(proxyer.ACCESS, cidr)
    }
    for _, addr := range strings.Split(S_LISTEN, ",") {
        _D("listening @ :%s\n", addr)
        go func() {
            if err := dns.ListenAndServe(addr, "udp", proxyer); err != nil {
                log.Fatal(err)
            }
        }()

        go func() {
            if err := dns.ListenAndServe(addr, "tcp", proxyer); err != nil {
                log.Fatal(err)
            }
        }()
    }

    for {
        proxyer.NOW = time.Now().UTC().Unix()
        time.Sleep(time.Duration(1) * time.Second)
    }
}

开发者ID:yiyuandao,项目名称:DNS-layer-Fragmentation,代码行数:60,代码来源:ServerProxy.go

最后编辑: kuteng  文档更新时间: 2021-08-23 19:14   作者:kuteng