gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-go-plugins] 01/04: Removed obsolete example.


From: gnunet
Subject: [gnunet-go-plugins] 01/04: Removed obsolete example.
Date: Sun, 30 Oct 2022 18:22:41 +0100

This is an automated email from the git hooks/post-receive script.

bernd-fix pushed a commit to branch master
in repository gnunet-go-plugins.

commit f0afdae285ed4c9c1430da472ddde1925bdfce49
Author: Bernd Fix <brf@hoi-polloi.org>
AuthorDate: Sun Oct 30 18:08:26 2022 +0100

    Removed obsolete example.
---
 reclaimid/Makefile   |  30 --------------
 reclaimid/gui.htpl   |  37 -----------------
 reclaimid/main.go    | 114 ---------------------------------------------------
 reclaimid/rrtypes.go |  94 ------------------------------------------
 4 files changed, 275 deletions(-)

diff --git a/reclaimid/Makefile b/reclaimid/Makefile
deleted file mode 100644
index 4b04dc6..0000000
--- a/reclaimid/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-# This file is part of gnunet-go-plugins, a collection of plugins for
-# the GNUnet-implementation in Golang (gnunet.go). Plugins are used to
-# implement type-specific processing of resource records (e.g. GUI).
-# Copyright (C) 2022 by the authors:
-#
-# * Bernd Fix <brf@hoi-polloi.org>  >Y<
-#
-# gnunet-go-plugins is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License,
-# or (at your option) any later version.
-#
-# gnunet-go is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-# SPDX-License-Identifier: AGPL3.0-or-later
-
-
-all: ${GOPATH}/bin/plugin_reclaimid.so
-
-clean: ${GOPATH}/bin/plugin_reclaimid.so
-       rm -f $^
-
-${GOPATH}/bin/plugin_reclaimid.so: main.go gui.htpl
-       go build -buildmode=plugin -trimpath -gcflags="-N -l" -o $@ ./...
diff --git a/reclaimid/gui.htpl b/reclaimid/gui.htpl
deleted file mode 100644
index 2a8f5d8..0000000
--- a/reclaimid/gui.htpl
+++ /dev/null
@@ -1,37 +0,0 @@
-{{define "new_reclaim"}}
-    <h3>New Reclaim:ID resource record</h3>
-    <div>
-       <p>Ref = {{.Ref}}</p>
-           <p>Action = {{.Action}}</p>
-           <p>Button = {{.Button}}</p>
-        <p>Names: {{range $i,$v := .Names}}'{{$v}}',{{end}}</p>
-        <p>RRSpecs:</p>
-        <ul>
-            {{range $i,$s := .RRspecs}}
-            <li>Type = {{$s.Type}}, Flags = {{$s.Flags}}</li>
-            {{end}}
-        </ul>
-        <p>Params:</p>
-        <ul>
-        {{range $k,$v := .Params}}
-            <li>'{{$k}}' = '{{$v}}'</li>
-        {{end}}
-        </ul>
-    </div>
-    <a href="/"><button>Leave</button></a>
-{{end}}
-{{define "edit_reclaim"}}
-    <h3>Edit Reclaim:ID resource record</h3>
-    <div>
-       <p>Ref = {{.Ref}}</p>
-           <p>Action = {{.Action}}</p>
-           <p>Button = {{.Button}}</p>
-        <p>Names: {{range $i,$v := .Names}}'{{$v}}',{{end}}</p>
-        <ul>
-        {{range $k,$v := .Params}}
-            <li>'{{$k}}' = '{{$v}}'</li>
-        {{end}}
-        </ul>
-    </div>
-    <a href="/"><button>Leave</button></a>
-{{end}}
diff --git a/reclaimid/main.go b/reclaimid/main.go
deleted file mode 100644
index b8e5ad7..0000000
--- a/reclaimid/main.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// This file is part of gnunet-go-plugins, a collection of plugins for
-// the GNUnet-implementation in Golang (gnunet.go). Plugins are used to
-// implement type-specific processing of resource records (e.g. GUI).
-// Copyright (C) 2022 by the authors:
-//
-// * Bernd Fix <brf@hoi-polloi.org>  >Y<
-//
-// gnunet-go-plugins is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published
-// by the Free Software Foundation, either version 3 of the License,
-// or (at your option) any later version.
-//
-// gnunet-go is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// SPDX-License-Identifier: AGPL3.0-or-later
-
-package main
-
-import (
-       _ "embed"
-
-       "github.com/bfix/gospel/data"
-)
-
-// List of handled resource record types.
-var handledTypes = []uint32{
-       65544, // RECLAIM_ATTRIBUTE
-       65545, // RECLAIM_TICKET
-       65550, // RECLAIM_ATTRIBUTE_REF
-       65552, // RECLAIM_OIDC_CLIENT
-       65553, // RECLAIM_OIDC_REDIRECT
-       65554, // RECLAIM_CREDENTIAL
-       65555, // RECLAIM_PRESENTATION
-}
-
-// Plugin is the instance of a custom implementation accessed by the
-// gnunet-go framework
-//
-//nolint:deadcode // used by framework
-var Plugin = NewReclaimIDPlugin()
-
-// ReclaimIDPlugin is a handler of Reclaim:ID specific records that implements
-// the zonemaster.Plugin interface.
-type ReclaimIDPlugin struct{}
-
-// NewReclaimIDPlugin creates an initialized plugin instance
-func NewReclaimIDPlugin() ReclaimIDPlugin {
-       return ReclaimIDPlugin{}
-}
-
-//----------------------------------------------------------------------
-// Interface implementation
-//----------------------------------------------------------------------
-
-// Name returns the plugin name (sub-system name)
-func (p *ReclaimIDPlugin) Name() string {
-       return "Reclaim:ID"
-}
-
-// CanHandle returns a list of resource record types that are handled by the
-// plugin
-func (p *ReclaimIDPlugin) CanHandle() (list []uint32) {
-       return handledTypes
-}
-
-//go:embed gui.htpl
-var tpl []byte
-
-// Template returns the new / edit template for resource record types
-// handled by the plugin.
-func (p *ReclaimIDPlugin) Template() string {
-       return string(tpl)
-}
-
-// TemplateNames returns the names of the new / edit template
-func (p *ReclaimIDPlugin) TemplateNames() (string, string) {
-       return "new_reclaim", "edit_reclaim"
-}
-
-// Value returns a human-readable description of RR data
-func (p *ReclaimIDPlugin) Value(t uint32, rr []byte) (string, error) {
-       rec, err := GetInstance(t, rr)
-       if err != nil {
-               return "", err
-       }
-       return rec.Value()
-}
-
-// ToMap converts resource record data into GUI template variables
-func (p *ReclaimIDPlugin) ToMap(t uint32, rr []byte) (map[string]string, 
error) {
-       rec, err := GetInstance(t, rr)
-       if err != nil {
-               return nil, err
-       }
-       return rec.ToMap()
-}
-
-// FromMap converts a GUI template variables into resource record data
-func (p *ReclaimIDPlugin) FromMap(t uint32, vars map[string]string) ([]byte, 
error) {
-       rec, err := GetInstance(t, nil)
-       if err != nil {
-               return nil, err
-       }
-       if err = rec.FromMap(vars); err != nil {
-               return nil, err
-       }
-       return data.Marshal(rec)
-}
diff --git a/reclaimid/rrtypes.go b/reclaimid/rrtypes.go
deleted file mode 100644
index 7a92254..0000000
--- a/reclaimid/rrtypes.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// This file is part of gnunet-go-plugins, a collection of plugins for
-// the GNUnet-implementation in Golang (gnunet.go). Plugins are used to
-// implement type-specific processing of resource records (e.g. GUI).
-// Copyright (C) 2022 by the authors:
-//
-// * Bernd Fix <brf@hoi-polloi.org>  >Y<
-//
-// gnunet-go-plugins is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published
-// by the Free Software Foundation, either version 3 of the License,
-// or (at your option) any later version.
-//
-// gnunet-go is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-// SPDX-License-Identifier: AGPL3.0-or-later
-
-package main
-
-import (
-       "errors"
-
-       "github.com/bfix/gospel/data"
-)
-
-// ReclaimRecord interface impemented by custom types.
-type ReclaimRecord interface {
-       Value() (string, error)
-       ToMap() (map[string]string, error)
-       FromMap(map[string]string) error
-}
-
-// Get record instance for given type and data
-func GetInstance(t uint32, buf []byte) (rec ReclaimRecord, err error) {
-       switch t {
-       case 65544: // RECLAIM_ATTRIBUTE
-               rec = new(ReclaimAttribute)
-       case 65545: // RECLAIM_TICKET
-       case 65550: // RECLAIM_ATTRIBUTE_REF
-       case 65552: // RECLAIM_OIDC_CLIENT
-       case 65553: // RECLAIM_OIDC_REDIRECT
-       case 65554: // RECLAIM_CREDENTIAL
-       case 65555: // RECLAIM_PRESENTATION
-       }
-       if buf != nil {
-               err = data.Unmarshal(rec, buf)
-       }
-       return
-}
-
-//======================================================================
-// Reclaim Resource Records
-//======================================================================
-
-//----------------------------------------------------------------------
-// Reclaim Attribute
-//----------------------------------------------------------------------
-
-// ReclaimAttribute record
-type ReclaimAttribute struct {
-       ID         []byte `size:"32"`      // Reclaim identifier
-       Credential []byte `size:"32"`      // Reclaim identifier
-       Claim      uint32 `order:"big"`    // claim
-       Type       uint32 `order:"big"`    // type
-       Flags      uint32 `order:"big"`    // flags
-       Name       string ``               // name
-       LenData    uint16 `order:"big"`    // length of data
-       Data       []byte `size:"LenData"` // binary data
-}
-
-// Value returns a human-readable representation of the record
-func (rec *ReclaimAttribute) Value() (string, error) {
-       return "", errors.New("not implemented yet")
-}
-
-// ToMap returns the parameter set for the record
-func (rec *ReclaimAttribute) ToMap() (params map[string]string, err error) {
-       params = make(map[string]string)
-       return
-}
-
-// FromMap reconstructs the record attributes from parameter list
-func (rec *ReclaimAttribute) FromMap(params map[string]string) error {
-       return nil
-}
-
-//----------------------------------------------------------------------
-// Reclaim ...
-//----------------------------------------------------------------------

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]