Debian Codegraph @

control/cmd_stream.go

raw symbols SCIP
1 package control
2
3 import (
4 "strconv"
5 )
6
7 // AttachStream invokes ATTACHSTREAM.
8 func (c *Conn) AttachStream(streamID string, circuitID string, hopNum int) error {
9 if circuitID == "" {
10 circuitID = "0"
11 }
12 cmd := "ATTACHSTREAM " + streamID + " " + circuitID
13 if hopNum > 0 {
14 cmd += " HOP=" + strconv.Itoa(hopNum)
15 }
16 return c.sendRequestIgnoreResponse(cmd)
17 }
18
19 // RedirectStream invokes REDIRECTSTREAM.
20 func (c *Conn) RedirectStream(streamID string, address string, port int) error {
21 cmd := "REDIRECTSTREAM " + streamID + " " + address
22 if port > 0 {
23 cmd += " " + strconv.Itoa(port)
24 }
25 return c.sendRequestIgnoreResponse(cmd)
26 }
27
28 // CloseStream invokes CLOSESTREAM.
29 func (c *Conn) CloseStream(streamID string, reason string) error {
30 return c.sendRequestIgnoreResponse("CLOSESTREAM %v %v", streamID, reason)
31 }