@@ -25,27 +25,27 @@ type DeviceSetting struct {
2525func CreateIPCRequest (conf * DeviceConfig ) (* DeviceSetting , error ) {
2626 var request bytes.Buffer
2727
28- request . WriteString ( fmt .Sprintf ( "private_key=%s\n " , conf .SecretKey ) )
28+ fmt .Fprintf ( & request , "private_key=%s\n " , conf .SecretKey )
2929
3030 if conf .ListenPort != nil {
31- request . WriteString ( fmt .Sprintf ( "listen_port=%d\n " , * conf .ListenPort ) )
31+ fmt .Fprintf ( & request , "listen_port=%d\n " , * conf .ListenPort )
3232 }
3333
3434 for _ , peer := range conf .Peers {
35- request . WriteString ( fmt .Sprintf ( heredoc .Doc (`
35+ fmt .Fprintf ( & request , heredoc .Doc (`
3636 public_key=%s
3737 persistent_keepalive_interval=%d
3838 preshared_key=%s
3939 ` ),
4040 peer .PublicKey , peer .KeepAlive , peer .PreSharedKey ,
41- ))
41+ )
4242 if peer .Endpoint != nil {
43- request . WriteString ( fmt .Sprintf ( "endpoint=%s\n " , * peer .Endpoint ) )
43+ fmt .Fprintf ( & request , "endpoint=%s\n " , * peer .Endpoint )
4444 }
4545
4646 if len (peer .AllowedIPs ) > 0 {
4747 for _ , ip := range peer .AllowedIPs {
48- request . WriteString ( fmt .Sprintf ( "allowed_ip=%s\n " , ip .String () ))
48+ fmt .Fprintf ( & request , "allowed_ip=%s\n " , ip .String ())
4949 }
5050 } else {
5151 request .WriteString (heredoc .Doc (`
0 commit comments