blob: 3caf1ff1de69c407700eab2944d133783c0c864b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package ssh
import (
"fmt"
"log"
"net"
"os"
"github.com/armon/go-socks5"
. "gopkg.in/check.v1"
)
type ProxySuite struct {
UploadPackSuite
}
var _ = Suite(&ProxySuite{})
func (s *ProxySuite) SetUpSuite(c *C) {
s.UploadPackSuite.SetUpSuite(c)
l, err := net.Listen("tcp", "localhost:0")
c.Assert(err, IsNil)
server, err := socks5.New(&socks5.Config{})
c.Assert(err, IsNil)
port := l.Addr().(*net.TCPAddr).Port
err = os.Setenv("ALL_PROXY", fmt.Sprintf("socks5://localhost:%d", port))
c.Assert(err, IsNil)
go func() {
log.Fatal(server.Serve(l))
}()
}
|