aboutsummaryrefslogtreecommitdiff
path: root/rpc.go
blob: 589ca92bbe8eec2a60595e91749afb76dbe08750 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"crypto/rsa"
	"encoding/gob"
	"log"
	"net/rpc"
)

type GoXY struct{}

func init() {
	gob.Register(rsa.PrivateKey{})
	rpc.Register(GoXY{})
}

func (GoXY) Add(e Entry, _ *struct{}) error {
	log.Println("Add route", e)
	defer route.Save(*data)
	route[e.ServerName] = e
	route.Restore()
	return nil
}

func (GoXY) Del(e Entry, _ *struct{}) error {
	log.Println("Del route", e)
	defer route.Save(*data)
	delete(route, e.ServerName)
	route.Restore()
	return nil
}

func (GoXY) List(_ struct{}, r *Route) error {
	*r = route
	return nil
}