MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / createRequestData

Function createRequestData

socks/request_test.go:12–31  ·  view source on GitHub ↗
(version, command uint8, ip net.IP, port uint16)

Source from the content-addressed store, hash-verified

10)
11
12func createRequestData(version, command uint8, ip net.IP, port uint16) []byte {
13 // set the command
14 b := []byte{version, command, 0}
15
16 // append the ip
17 if len(ip) == net.IPv4len {
18 b = append(b, 1)
19 b = append(b, ip.To4()...)
20 } else {
21 b = append(b, 4)
22 b = append(b, ip.To16()...)
23 }
24
25 // append the port
26 p := []byte{0, 0}
27 binary.BigEndian.PutUint16(p, port)
28 b = append(b, p...)
29
30 return b
31}
32
33func createRequest(t *testing.T, version, command uint8, ipStr string, port uint16, shouldFail bool) *Request {
34 ip := net.ParseIP(ipStr)

Callers 1

createRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected