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