use & instead of fmt

master
Christian Ulrich 2020-10-23 01:21:19 +02:00
parent 70778f972e
commit 287e344779
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
3 changed files with 5 additions and 6 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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.} =