GNU bug report logs - #73465
[PATCH] Wireguard: Rename field private-key to private-key-file

Previous Next

Package: guix-patches;

Reported by: Apoorv Singh <apoorvs569 <at> gmail.com>

Date: Wed, 25 Sep 2024 05:47:02 UTC

Severity: normal

Tags: patch

Full log


Message #11 received at 73465 <at> debbugs.gnu.org (full text, mbox):

From: Apoorv Singh <apoorvs569 <at> gmail.com>
To: 73465 <at> debbugs.gnu.org
Subject: Wireguard: Rename field private-key to private-key-file
Date: Sat, 28 Sep 2024 10:59:26 +0530
Do you want me to keep both private-key and private-key-file in 
the record but still use private-key for now? but just warn about 
deprecation for the field? Something like,

```
(define-record-type* <wireguard-configuration>
 wireguard-configuration make-wireguard-configuration
 wireguard-configuration?

 ;; other fields here..

 (private-key        wireguard-configuration-private-key-file 
 ;deprecated
                     (default "/etc/wireguard/private.key"))
 (private-key-file   wireguard-configuration-private-key-file 
 ;string
                     (default "/etc/wireguard/private.key"))
```

then, in the `wireguard-configuration-file` procedure, under 
`match-record`, I should do something like,
```
 (match-record config <wireguard-configuration>
   (wireguard interface addresses port private-key peers dns   ;; 
   keeping private-key field here..
              pre-up post-up pre-down post-down table)
   (let* ((config-file (string-append interface ".conf"))
          (peer-keys (fold peers->preshared-keys (list) peers))
          (peers (map peer->config peers))
          (config
           (computed-file
            "wireguard-config"
            #~(begin
                (use-modules (ice-9 format)
                             (srfi srfi-1))

                (define lines
                  (list
                    ;; other stuff..

                   (when (not (string-null? #$private-key))
                     (warn-about-deprecation 'private-key
                                             #f
                                             #:replacement 
                                             'private-key-file))

                   (format #f "PostUp = ~a set %i private-key ~a\
~{ peer ~a preshared-key ~a~}" #$(file-append wireguard "/bin/wg")
#$private-key '#$peer-keys)     ;; using private-key field here 
still..


Sorry I'm not familiar with how all this works. Just making sure 
before I commit any changes.

Also by adjust the documentation you mean edit the 
doc/guix.texi:34373 file and append something like,
```
@item @code{private-key} (default: 
@code{"/etc/wireguard/private.key"})
The private key file for the interface.  It is automatically 
generated
if the file does not exist.  'Using private-key' is deprecated use 
'private-key-file' instead.
```

-- 
- Apoorv Singh
- Sent from Emacs.




This bug report was last modified 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.