Debian Codegraph @

control/cmd_circuit.go

raw symbols SCIP
1 package controlscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/
2
3 import (
4 "stringsscip-go gomod github.com/golang/go/src go1.15 strings/"
5 )
6
7 // ExtendCircuit invokes EXTENDCIRCUIT and returns the circuit ID on success.
8 func (c *Connscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#) ExtendCircuitscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#ExtendCircuit().(circuitID string, path []string, purpose string) (string, error) {
9 if circuitID == "" {
10 circuitID = "0"
11 }
12 cmd := "EXTENDCIRCUIT " + circuitID
13 if len(path) > 0 {
14 cmd += " " + stringsscip-go gomod github.com/golang/go/src go1.15 strings/.Joinscip-go gomod github.com/golang/go/src go1.15 strings/Join().(path, ",")
15 }
16 if purpose != "" {
17 cmd += " purpose=" + purpose
18 }
19 resp, err := c.SendRequestscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#SendRequest().(cmd)
20 if err != nil {
21 return "", err
22 }
23 return resp.Replyscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Response#Reply.[stringsscip-go gomod github.com/golang/go/src go1.15 strings/.LastIndexBytescip-go gomod github.com/golang/go/src go1.15 strings/LastIndexByte().(resp.Replyscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Response#Reply., ' ')+1:], nil
24 }
25
26 // SetCircuitPurpose invokes SETCIRCUITPURPOSE.
27 func (c *Connscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#) SetCircuitPurposescip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#SetCircuitPurpose().(circuitID string, purpose string) error {
28 return c.sendRequestIgnoreResponsescip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#sendRequestIgnoreResponse().("SETCIRCUITPURPOSE %v purpose=%v", circuitID, purpose)
29 }
30
31 // CloseCircuit invokes CLOSECIRCUIT.
32 func (c *Connscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#) CloseCircuitscip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#CloseCircuit().(circuitID string, flags []string) error {
33 cmd := "CLOSECIRCUIT " + circuitID
34 for _, flag := range flags {
35 cmd += " " + flag
36 }
37 return c.sendRequestIgnoreResponsescip-go gomod github.com/cretz/bine . `github.com/cretz/bine/control`/Conn#sendRequestIgnoreResponse().(cmd)
38 }