blob: 6fde0a82ef69ce9d792db21ad8d5135a5e3e2afa (
plain)
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
|
package control
import (
"strconv"
)
// AttachStream invokes ATTACHSTREAM.
func (c *Conn) AttachStream(streamID string, circuitID string, hopNum int) error {
if circuitID == "" {
circuitID = "0"
}
cmd := "ATTACHSTREAM " + streamID + " " + circuitID
if hopNum > 0 {
cmd += " HOP=" + strconv.Itoa(hopNum)
}
return c.sendRequestIgnoreResponse(cmd)
}
// RedirectStream invokes REDIRECTSTREAM.
func (c *Conn) RedirectStream(streamID string, address string, port int) error {
cmd := "REDIRECTSTREAM " + streamID + " " + address
if port > 0 {
cmd += " " + strconv.Itoa(port)
}
return c.sendRequestIgnoreResponse(cmd)
}
// CloseStream invokes CLOSESTREAM.
func (c *Conn) CloseStream(streamID string, reason string) error {
return c.sendRequestIgnoreResponse("CLOSESTREAM %v %v", streamID, reason)
}
|