use & instead of fmt
This commit is contained in:
parent
70778f972e
commit
287e344779
|
@ -239,7 +239,7 @@ proc runApp(serverHostname: string, serverPort: Port, peerId: string,
|
|||
srcPort)
|
||||
asyncCheck handleServerMessages(serverConn)
|
||||
let sock = await punchHole(punchdConn, serverConn, peerId, otherPeerId,
|
||||
"tcp-nutss")
|
||||
"tcp-syni")
|
||||
echo "connected!"
|
||||
await sock.send("ping")
|
||||
let msg = await sock.recv(4)
|
||||
|
|
|
@ -136,7 +136,7 @@ proc serve(port: Port) {.async.} =
|
|||
|
||||
proc main() =
|
||||
if paramCount() != 1:
|
||||
echo(fmt"usage: {paramStr(0)} PORT")
|
||||
echo(&"usage: {paramStr(0)} PORT")
|
||||
quit(1)
|
||||
|
||||
try:
|
||||
|
|
|
@ -54,8 +54,7 @@ method respond*(puncher: Responder, args: string):
|
|||
|
||||
proc makeFirewallRule(srcIp: IpAddress, srcPort: Port,
|
||||
dstIp: IpAddress, dstPort: Port): string =
|
||||
# FIXME: use & instead of fmt?
|
||||
result = fmt"""-w \
|
||||
result = &"""-w \
|
||||
-d {srcIp} \
|
||||
-p icmp \
|
||||
--icmp-type time-exceeded \
|
||||
|
@ -69,11 +68,11 @@ proc makeFirewallRule(srcIp: IpAddress, srcPort: Port,
|
|||
-j DROP"""
|
||||
|
||||
proc iptablesInsert(chain: string, rule: string) {.async.} =
|
||||
let firewall_cmd = fmt"iptables -I {chain} {rule}"
|
||||
let firewall_cmd = &"iptables -I {chain} {rule}"
|
||||
discard await asyncExecCmd(firewall_cmd)
|
||||
|
||||
proc iptablesDelete(chain: string, rule: string) {.async.} =
|
||||
let firewall_cmd = fmt"iptables -D {chain} {rule}"
|
||||
let firewall_cmd = &"iptables -D {chain} {rule}"
|
||||
discard await asyncExecCmd(firewall_cmd)
|
||||
|
||||
proc addFirewallRules*(attempt: Attempt) {.async.} =
|
||||
|
|
Loading…
Reference in New Issue