Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Golang-跳过SSL/x509验证和构建包?_Ssl_Go_Compilation - Fatal编程技术网

Golang-跳过SSL/x509验证和构建包?

Golang-跳过SSL/x509验证和构建包?,ssl,go,compilation,Ssl,Go,Compilation,我对围棋语言一无所知,我只想在Ubuntu 14上使用这个应用程序: 在做任何事情之前,我必须这样做。自述文件中说,此程序安装有: go get -u github.com/mvdan/fdroidcl/cmd/fdroidcl 这会顺利通过,并找到一个可执行文件。事实上,这些是在home中找到的文件,其中GOPATH是~/go: $ find ~ -name 'fdroidcl*' 2>/dev/null /home/myusername/.cache/fdroidcl /ho

我对围棋语言一无所知,我只想在Ubuntu 14上使用这个应用程序:

在做任何事情之前,我必须这样做。自述文件中说,此程序安装有:

go get -u github.com/mvdan/fdroidcl/cmd/fdroidcl
这会顺利通过,并找到一个可执行文件。事实上,这些是在home中找到的文件,其中
GOPATH
~/go

$ find ~ -name 'fdroidcl*' 2>/dev/null 
/home/myusername/.cache/fdroidcl
/home/myusername/.config/fdroidcl
/home/myusername/go/pkg/gccgo_linux_386/github.com/mvdan/fdroidcl
/home/myusername/go/src/github.com/mvdan/fdroidcl
/home/myusername/go/src/github.com/mvdan/fdroidcl/cmd/fdroidcl
/home/myusername/go/bin/fdroidcl
var config = userConfig{
        Repos: []repo{
                {
                        ID:      "f-droid",
                        //URL:     "https://f-droid.org/repo",
                        URL:     "http://f-droid.org/repo",
                        Enabled: true,
                },
                {
                        ID:      "f-droid-archive",
                        //URL:     "https://f-droid.org/archive",
                        URL:     "http://f-droid.org/archive",
                        Enabled: false,
                },
        },
}
很好,但是现在当我启动初始命令时:

$ fdroidcl updateDownloading https://f-droid.org/repo/index.jar... 
update: could not update index: Get https://f-droid.org/repo/index.jar: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "COMODO RSA Certification Authority")
这很可能是自签名证书导致的故障。一个快速修复方法是使用http://而不是https://(在
f-droid.org
的情况下,目前是可能的),因此我尝试更改
~/go/src/github.com/mvdan/fdroidcl/cmd/fdroidcl/main.go

$ find ~ -name 'fdroidcl*' 2>/dev/null 
/home/myusername/.cache/fdroidcl
/home/myusername/.config/fdroidcl
/home/myusername/go/pkg/gccgo_linux_386/github.com/mvdan/fdroidcl
/home/myusername/go/src/github.com/mvdan/fdroidcl
/home/myusername/go/src/github.com/mvdan/fdroidcl/cmd/fdroidcl
/home/myusername/go/bin/fdroidcl
var config = userConfig{
        Repos: []repo{
                {
                        ID:      "f-droid",
                        //URL:     "https://f-droid.org/repo",
                        URL:     "http://f-droid.org/repo",
                        Enabled: true,
                },
                {
                        ID:      "f-droid-archive",
                        //URL:     "https://f-droid.org/archive",
                        URL:     "http://f-droid.org/archive",
                        Enabled: false,
                },
        },
}
。。。但该命令实际上是二进制的:

$ file $(which fdroidcl)
~/go/bin/fdroidcl: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=cd1dc87b54f9023983511ef46fda15a4d88dcb2d, not stripped
。。。这意味着我必须以某种方式从源代码重新构建此应用程序,以便获得这些更改-我将如何做到这一点

此外,可能还有其他具有自签名https证书的应用程序会中断,因此我宁愿跳过SSL/X509验证。正如前面所指出的,人们似乎应该在代码中这样做:

tr := http.DefaultTransport.(*http.Transport)
tr.TLSClientConfig.InsecureSkipVerify = true

。。。这同样需要对源代码进行黑客攻击/重新编译,但是否有某种环境变量可以帮助您做到这一点,例如?

在更新源代码后(在
$GOPATH/src
中),您可以尝试使用以下命令重新编译:

go install github.com/mvdan/fdroidcl/cmd/fdroidcl

这不是一个关于围棋的问题,也不是一个真正适合围棋的问题。当然,你必须在更改源代码后重新编译。谢谢@Volker-我真的很抱歉浪费了你的时间。你认为什么更适合这个问题?我会立即给它贴上标签,这样它就会被转移到另一个论坛。顺便说一句-当然我必须重新编译,我知道这么多-但我要问的是使用什么命令?谢谢,@JoshLubawy-我本以为build命令是
go build
或其他什么,没想到
go install
。您能否详细介绍一下这个
安装到哪里
安装到哪里-是
~/go/bin/
;或者在git项目目录中是否有某种设置文件?
go-install
执行
go-build
并将生成的二进制文件放入$GOPATH/bin中(与
go-get
放置的位置相同)