31 lines
577 B
Go
31 lines
577 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
context "context"
|
||
|
)
|
||
|
|
||
|
// Country struct
|
||
|
type Country struct {
|
||
|
Pic []byte
|
||
|
Name []byte
|
||
|
}
|
||
|
|
||
|
var countrylist *KeyList = &KeyList{}
|
||
|
|
||
|
type countryserver struct {
|
||
|
}
|
||
|
|
||
|
func (s *countryserver) Name(cxt context.Context, request *Request) (*Reply, error) {
|
||
|
|
||
|
reply := &Reply{}
|
||
|
reply.Message = string(GetRandomKey(countrylist).(Country).Name)
|
||
|
return reply, nil
|
||
|
}
|
||
|
|
||
|
func (s *countryserver) Picture(cxt context.Context, request *Request) (*CountryReply, error) {
|
||
|
|
||
|
reply := &CountryReply{}
|
||
|
reply.Image = GetRandomKey(countrylist).(Country).Pic
|
||
|
return reply, nil
|
||
|
}
|