Skip to content

Commit

Permalink
Revert "hmm classes also kinda suck"
Browse files Browse the repository at this point in the history
This reverts commit 1e00cf4.
  • Loading branch information
ifd3f committed Apr 8, 2024
1 parent 1e00cf4 commit 2bf93e8
Showing 1 changed file with 25 additions and 45 deletions.
70 changes: 25 additions & 45 deletions netconf/util.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
(for-doc scribble/base scribble/manual))

(require net/ip)
(require rebellion/type/record)
(require racket/symbol)
(require racket/trait)


(provide
command->string
Expand All @@ -30,8 +31,7 @@
(set policy route-map dn42-roa rule 20 action permit)
(set policy route-map dn42-roa rule 20 match rpki notfound)
(set policy route-map dn42-roa rule 30 action deny)
(set policy route-map dn42-roa rule 30 match rpki invalid))]})
)
(set policy route-map dn42-roa rule 30 match rpki invalid))]}))

(define (command->string c)
(string-join (map (match-lambda
Expand All @@ -55,49 +55,29 @@
(cons (cons obj before) after)]
[('()) (cons '() '())])

(define dual-stack
(interface () into-af))

(define wireguard/tunnel%
(class object%
(super-new)
(init-field ifname
our-address
our-private-key
description
peers
our-endpoint-port)))

(define wireguard/peer
(class object%
(super-new)
(init-field name
public-key
endpoint)))
(define-record-type WireguardTunnel
(ifname
our-address
our-private-key
description
peers
our-endpoint-port))

(define bgp/link-local-peer
(class object%
(super-new)
(init-field link-ifname
description
peer-address
peer-asn
peer-group)))
(define-record-type WireguardPeer
(name
public-key
endpoint))

(define firewall/rule
(class* object% (dual-stack)
(super-new)
(init-field description
cmds
src
dst)
(define/public (into-af af)
(new firewall/rule
[description (get-field description this)]
[cmds (get-field cmds this)]
[src (into-af (get-field src this))]
[dst (into-af (get-field dst this))]))))
(define-record-type LinkLocalBgpPeer
(link-ifname
description
peer-address
peer-asn
peer-group))

(define address
(define-record-type FirewallRule
(description
cmds
src
dst))

(new firewall/rule [description "test"] [cmds '(abc)] [src

0 comments on commit 2bf93e8

Please sign in to comment.