Forráskód Böngészése

feat(vpn): show available network types via cli && fetch associated user
list from rpc in net list command

Mustafa Arici 8 éve
szülő
commit
fc9f6c78ab
8 módosított fájl, 236 hozzáadás és 58 törlés
  1. 15 2
      api/rpc.go
  2. 1 1
      bindata/bindata.go
  3. 1 0
      cmd/ovpm/main.go
  4. 48 11
      cmd/ovpm/net.go
  5. 15 5
      net.go
  6. 139 38
      pb/network.pb.go
  7. 14 1
      pb/network.proto
  8. 3 0
      pb/user.pb.go

+ 15 - 2
api/rpc.go

@@ -244,14 +244,27 @@ func (s *NetworkService) Delete(ctx context.Context, req *pb.NetworkDeleteReques
 
 func (s *NetworkService) GetAllTypes(ctx context.Context, req *pb.NetworkGetAllTypesRequest) (*pb.NetworkGetAllTypesResponse, error) {
 	logrus.Debugf("rpc call: network get-types")
-	var networkTypes []string
+	var networkTypes []*pb.NetworkType
 	for _, nt := range ovpm.GetAllNetworkTypes() {
-		networkTypes = append(networkTypes, nt.String())
+		if nt == ovpm.UNDEFINEDNET {
+			continue
+		}
+		networkTypes = append(networkTypes, &pb.NetworkType{Type: nt.String(), Description: nt.Description()})
 	}
 
 	return &pb.NetworkGetAllTypesResponse{Types: networkTypes}, nil
 }
 
+func (s *NetworkService) GetAssociatedUsers(ctx context.Context, req *pb.NetworkGetAssociatedUsersRequest) (*pb.NetworkGetAssociatedUsersResponse, error) {
+	logrus.Debugf("rpc call: network get-associated-users")
+	network, err := ovpm.GetNetwork(req.Name)
+	if err != nil {
+		return nil, err
+	}
+	usernames := network.GetAssociatedUsernames()
+	return &pb.NetworkGetAssociatedUsersResponse{Usernames: usernames}, nil
+}
+
 func (s *NetworkService) Associate(ctx context.Context, req *pb.NetworkAssociateRequest) (*pb.NetworkAssociateResponse, error) {
 	logrus.Debugf("rpc call: network associate")
 

+ 1 - 1
bindata/bindata.go

@@ -87,7 +87,7 @@ func templateCcdFileTmpl() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "template/ccd.file.tmpl", size: 157, mode: os.FileMode(420), modTime: time.Unix(1503785209, 0)}
+	info := bindataFileInfo{name: "template/ccd.file.tmpl", size: 157, mode: os.FileMode(420), modTime: time.Unix(1503786351, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }

+ 1 - 0
cmd/ovpm/main.go

@@ -59,6 +59,7 @@ func main() {
 			Usage: "Network Operations",
 			Subcommands: []cli.Command{
 				netListCommand,
+				netTypesCommand,
 				netDefineCommand,
 				netUndefineCommand,
 				netAssociateCommand,

+ 48 - 11
cmd/ovpm/net.go

@@ -14,8 +14,8 @@ import (
 )
 
 var netDefineCommand = cli.Command{
-	Name:    "define",
-	Aliases: []string{"def", "d"},
+	Name:    "def",
+	Aliases: []string{"d"},
 	Usage:   "Define a network.",
 	Flags: []cli.Flag{
 		cli.StringFlag{
@@ -91,8 +91,8 @@ var netDefineCommand = cli.Command{
 
 var netListCommand = cli.Command{
 	Name:    "list",
-	Aliases: []string{"lis", "l"},
-	Usage:   "List network definitions.",
+	Aliases: []string{"l"},
+	Usage:   "List defined networks.",
 	Action: func(c *cli.Context) error {
 		action = "net:list"
 		conn := getConn(c.GlobalString("daemon-port"))
@@ -105,13 +105,21 @@ var netListCommand = cli.Command{
 			os.Exit(1)
 			return err
 		}
+
 		table := tablewriter.NewWriter(os.Stdout)
 		table.SetHeader([]string{"#", "name", "cidr", "type", "assoc", "created at"})
 		//table.SetBorder(false)
 		for i, network := range resp.Networks {
 			// Create associated user list for this network.
 			var usernameList string
-			usernames := network.GetAssociatedUsernames()
+			assocUsers, err := netSvc.GetAssociatedUsers(context.Background(), &pb.NetworkGetAssociatedUsersRequest{Name: network.Name})
+			if err != nil {
+				logrus.Errorf("assoc users can not be fetched: %v", err)
+				os.Exit(1)
+				return err
+			}
+
+			usernames := assocUsers.Usernames
 			count := len(usernames)
 			for i, uname := range usernames {
 				if i+1 == count {
@@ -137,9 +145,38 @@ var netListCommand = cli.Command{
 	},
 }
 
+var netTypesCommand = cli.Command{
+	Name:    "types",
+	Aliases: []string{"t"},
+	Usage:   "Show available network types.",
+	Action: func(c *cli.Context) error {
+		action = "net:types"
+		conn := getConn(c.GlobalString("daemon-port"))
+		defer conn.Close()
+		netSvc := pb.NewNetworkServiceClient(conn)
+
+		resp, err := netSvc.GetAllTypes(context.Background(), &pb.NetworkGetAllTypesRequest{})
+		if err != nil {
+			logrus.Errorf("networks can not be fetched: %v", err)
+			os.Exit(1)
+			return err
+		}
+		table := tablewriter.NewWriter(os.Stdout)
+		table.SetHeader([]string{"#", "net type", "desc"})
+		//table.SetBorder(false)
+		for i, ntype := range resp.Types {
+			data := []string{fmt.Sprintf("%v", i+1), ntype.Type, ntype.Description}
+			table.Append(data)
+		}
+		table.Render()
+
+		return nil
+	},
+}
+
 var netUndefineCommand = cli.Command{
-	Name:    "undefine",
-	Aliases: []string{"undef", "u"},
+	Name:    "undef",
+	Aliases: []string{"u"},
 	Usage:   "Undefine an existing network.",
 	Flags: []cli.Flag{
 		cli.StringFlag{
@@ -173,8 +210,8 @@ var netUndefineCommand = cli.Command{
 }
 
 var netAssociateCommand = cli.Command{
-	Name:    "associate",
-	Aliases: []string{"assoc", "a"},
+	Name:    "assoc",
+	Aliases: []string{"a"},
 	Usage:   "Associate a user with a network.",
 	Flags: []cli.Flag{
 		cli.StringFlag{
@@ -214,8 +251,8 @@ var netAssociateCommand = cli.Command{
 }
 
 var netDissociateCommand = cli.Command{
-	Name:    "dissociate",
-	Aliases: []string{"dissoc", "d"},
+	Name:    "dissoc",
+	Aliases: []string{"d"},
 	Usage:   "Dissociate a user from a network.",
 	Flags: []cli.Flag{
 		cli.StringFlag{

+ 15 - 5
net.go

@@ -26,12 +26,13 @@ const (
 )
 
 var networkTypes = [...]struct {
-	Type   NetworkType
-	String string
+	Type        NetworkType
+	String      string
+	Description string
 }{
-	{UNDEFINEDNET, "UNDEFINEDNET"},
-	{SERVERNET, "SERVERNET"},
-	{ROUTE, "ROUTE"},
+	{UNDEFINEDNET, "UNDEFINEDNET", "unknown network type"},
+	{SERVERNET, "SERVERNET", "network behind vpn server"},
+	{ROUTE, "ROUTE", "network to be pushed as route"},
 }
 
 // NetworkTypeFromString returns string representation of the network type.
@@ -62,6 +63,15 @@ func (nt NetworkType) String() string {
 	return "UNDEFINEDNET"
 }
 
+func (nt NetworkType) Description() string {
+	for _, v := range networkTypes {
+		if v.Type == nt {
+			return v.Description
+		}
+	}
+	return "UNDEFINEDNET"
+}
+
 // DBNetwork is database model for external networks on the VPN server.
 type DBNetwork struct {
 	gorm.Model

+ 139 - 38
pb/network.pb.go

@@ -137,6 +137,24 @@ func (m *NetworkDissociateRequest) GetUsername() string {
 	return ""
 }
 
+type NetworkGetAssociatedUsersRequest struct {
+	Name string `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"`
+}
+
+func (m *NetworkGetAssociatedUsersRequest) Reset()         { *m = NetworkGetAssociatedUsersRequest{} }
+func (m *NetworkGetAssociatedUsersRequest) String() string { return proto.CompactTextString(m) }
+func (*NetworkGetAssociatedUsersRequest) ProtoMessage()    {}
+func (*NetworkGetAssociatedUsersRequest) Descriptor() ([]byte, []int) {
+	return fileDescriptor2, []int{6}
+}
+
+func (m *NetworkGetAssociatedUsersRequest) GetName() string {
+	if m != nil {
+		return m.Name
+	}
+	return ""
+}
+
 type Network struct {
 	Name                string   `protobuf:"bytes,1,opt,name=Name" json:"Name,omitempty"`
 	CIDR                string   `protobuf:"bytes,2,opt,name=CIDR" json:"CIDR,omitempty"`
@@ -149,7 +167,7 @@ type Network struct {
 func (m *Network) Reset()                    { *m = Network{} }
 func (m *Network) String() string            { return proto.CompactTextString(m) }
 func (*Network) ProtoMessage()               {}
-func (*Network) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{6} }
+func (*Network) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{7} }
 
 func (m *Network) GetName() string {
 	if m != nil {
@@ -193,6 +211,30 @@ func (m *Network) GetVia() string {
 	return ""
 }
 
+type NetworkType struct {
+	Type        string `protobuf:"bytes,1,opt,name=Type" json:"Type,omitempty"`
+	Description string `protobuf:"bytes,2,opt,name=Description" json:"Description,omitempty"`
+}
+
+func (m *NetworkType) Reset()                    { *m = NetworkType{} }
+func (m *NetworkType) String() string            { return proto.CompactTextString(m) }
+func (*NetworkType) ProtoMessage()               {}
+func (*NetworkType) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{8} }
+
+func (m *NetworkType) GetType() string {
+	if m != nil {
+		return m.Type
+	}
+	return ""
+}
+
+func (m *NetworkType) GetDescription() string {
+	if m != nil {
+		return m.Description
+	}
+	return ""
+}
+
 type NetworkCreateResponse struct {
 	Network *Network `protobuf:"bytes,1,opt,name=Network" json:"Network,omitempty"`
 }
@@ -200,7 +242,7 @@ type NetworkCreateResponse struct {
 func (m *NetworkCreateResponse) Reset()                    { *m = NetworkCreateResponse{} }
 func (m *NetworkCreateResponse) String() string            { return proto.CompactTextString(m) }
 func (*NetworkCreateResponse) ProtoMessage()               {}
-func (*NetworkCreateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{7} }
+func (*NetworkCreateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{9} }
 
 func (m *NetworkCreateResponse) GetNetwork() *Network {
 	if m != nil {
@@ -216,7 +258,7 @@ type NetworkListResponse struct {
 func (m *NetworkListResponse) Reset()                    { *m = NetworkListResponse{} }
 func (m *NetworkListResponse) String() string            { return proto.CompactTextString(m) }
 func (*NetworkListResponse) ProtoMessage()               {}
-func (*NetworkListResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{8} }
+func (*NetworkListResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{10} }
 
 func (m *NetworkListResponse) GetNetworks() []*Network {
 	if m != nil {
@@ -232,7 +274,7 @@ type NetworkDeleteResponse struct {
 func (m *NetworkDeleteResponse) Reset()                    { *m = NetworkDeleteResponse{} }
 func (m *NetworkDeleteResponse) String() string            { return proto.CompactTextString(m) }
 func (*NetworkDeleteResponse) ProtoMessage()               {}
-func (*NetworkDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{9} }
+func (*NetworkDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{11} }
 
 func (m *NetworkDeleteResponse) GetNetwork() *Network {
 	if m != nil {
@@ -242,15 +284,15 @@ func (m *NetworkDeleteResponse) GetNetwork() *Network {
 }
 
 type NetworkGetAllTypesResponse struct {
-	Types []string `protobuf:"bytes,1,rep,name=Types" json:"Types,omitempty"`
+	Types []*NetworkType `protobuf:"bytes,1,rep,name=Types" json:"Types,omitempty"`
 }
 
 func (m *NetworkGetAllTypesResponse) Reset()                    { *m = NetworkGetAllTypesResponse{} }
 func (m *NetworkGetAllTypesResponse) String() string            { return proto.CompactTextString(m) }
 func (*NetworkGetAllTypesResponse) ProtoMessage()               {}
-func (*NetworkGetAllTypesResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{10} }
+func (*NetworkGetAllTypesResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{12} }
 
-func (m *NetworkGetAllTypesResponse) GetTypes() []string {
+func (m *NetworkGetAllTypesResponse) GetTypes() []*NetworkType {
 	if m != nil {
 		return m.Types
 	}
@@ -263,7 +305,7 @@ type NetworkAssociateResponse struct {
 func (m *NetworkAssociateResponse) Reset()                    { *m = NetworkAssociateResponse{} }
 func (m *NetworkAssociateResponse) String() string            { return proto.CompactTextString(m) }
 func (*NetworkAssociateResponse) ProtoMessage()               {}
-func (*NetworkAssociateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{11} }
+func (*NetworkAssociateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{13} }
 
 type NetworkDissociateResponse struct {
 }
@@ -271,7 +313,25 @@ type NetworkDissociateResponse struct {
 func (m *NetworkDissociateResponse) Reset()                    { *m = NetworkDissociateResponse{} }
 func (m *NetworkDissociateResponse) String() string            { return proto.CompactTextString(m) }
 func (*NetworkDissociateResponse) ProtoMessage()               {}
-func (*NetworkDissociateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{12} }
+func (*NetworkDissociateResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{14} }
+
+type NetworkGetAssociatedUsersResponse struct {
+	Usernames []string `protobuf:"bytes,1,rep,name=Usernames" json:"Usernames,omitempty"`
+}
+
+func (m *NetworkGetAssociatedUsersResponse) Reset()         { *m = NetworkGetAssociatedUsersResponse{} }
+func (m *NetworkGetAssociatedUsersResponse) String() string { return proto.CompactTextString(m) }
+func (*NetworkGetAssociatedUsersResponse) ProtoMessage()    {}
+func (*NetworkGetAssociatedUsersResponse) Descriptor() ([]byte, []int) {
+	return fileDescriptor2, []int{15}
+}
+
+func (m *NetworkGetAssociatedUsersResponse) GetUsernames() []string {
+	if m != nil {
+		return m.Usernames
+	}
+	return nil
+}
 
 func init() {
 	proto.RegisterType((*NetworkCreateRequest)(nil), "pb.NetworkCreateRequest")
@@ -280,13 +340,16 @@ func init() {
 	proto.RegisterType((*NetworkGetAllTypesRequest)(nil), "pb.NetworkGetAllTypesRequest")
 	proto.RegisterType((*NetworkAssociateRequest)(nil), "pb.NetworkAssociateRequest")
 	proto.RegisterType((*NetworkDissociateRequest)(nil), "pb.NetworkDissociateRequest")
+	proto.RegisterType((*NetworkGetAssociatedUsersRequest)(nil), "pb.NetworkGetAssociatedUsersRequest")
 	proto.RegisterType((*Network)(nil), "pb.Network")
+	proto.RegisterType((*NetworkType)(nil), "pb.NetworkType")
 	proto.RegisterType((*NetworkCreateResponse)(nil), "pb.NetworkCreateResponse")
 	proto.RegisterType((*NetworkListResponse)(nil), "pb.NetworkListResponse")
 	proto.RegisterType((*NetworkDeleteResponse)(nil), "pb.NetworkDeleteResponse")
 	proto.RegisterType((*NetworkGetAllTypesResponse)(nil), "pb.NetworkGetAllTypesResponse")
 	proto.RegisterType((*NetworkAssociateResponse)(nil), "pb.NetworkAssociateResponse")
 	proto.RegisterType((*NetworkDissociateResponse)(nil), "pb.NetworkDissociateResponse")
+	proto.RegisterType((*NetworkGetAssociatedUsersResponse)(nil), "pb.NetworkGetAssociatedUsersResponse")
 }
 
 // Reference imports to suppress errors if they are not otherwise used.
@@ -304,6 +367,7 @@ type NetworkServiceClient interface {
 	List(ctx context.Context, in *NetworkListRequest, opts ...grpc.CallOption) (*NetworkListResponse, error)
 	Delete(ctx context.Context, in *NetworkDeleteRequest, opts ...grpc.CallOption) (*NetworkDeleteResponse, error)
 	GetAllTypes(ctx context.Context, in *NetworkGetAllTypesRequest, opts ...grpc.CallOption) (*NetworkGetAllTypesResponse, error)
+	GetAssociatedUsers(ctx context.Context, in *NetworkGetAssociatedUsersRequest, opts ...grpc.CallOption) (*NetworkGetAssociatedUsersResponse, error)
 	Associate(ctx context.Context, in *NetworkAssociateRequest, opts ...grpc.CallOption) (*NetworkAssociateResponse, error)
 	Dissociate(ctx context.Context, in *NetworkDissociateRequest, opts ...grpc.CallOption) (*NetworkDissociateResponse, error)
 }
@@ -352,6 +416,15 @@ func (c *networkServiceClient) GetAllTypes(ctx context.Context, in *NetworkGetAl
 	return out, nil
 }
 
+func (c *networkServiceClient) GetAssociatedUsers(ctx context.Context, in *NetworkGetAssociatedUsersRequest, opts ...grpc.CallOption) (*NetworkGetAssociatedUsersResponse, error) {
+	out := new(NetworkGetAssociatedUsersResponse)
+	err := grpc.Invoke(ctx, "/pb.NetworkService/GetAssociatedUsers", in, out, c.cc, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *networkServiceClient) Associate(ctx context.Context, in *NetworkAssociateRequest, opts ...grpc.CallOption) (*NetworkAssociateResponse, error) {
 	out := new(NetworkAssociateResponse)
 	err := grpc.Invoke(ctx, "/pb.NetworkService/Associate", in, out, c.cc, opts...)
@@ -377,6 +450,7 @@ type NetworkServiceServer interface {
 	List(context.Context, *NetworkListRequest) (*NetworkListResponse, error)
 	Delete(context.Context, *NetworkDeleteRequest) (*NetworkDeleteResponse, error)
 	GetAllTypes(context.Context, *NetworkGetAllTypesRequest) (*NetworkGetAllTypesResponse, error)
+	GetAssociatedUsers(context.Context, *NetworkGetAssociatedUsersRequest) (*NetworkGetAssociatedUsersResponse, error)
 	Associate(context.Context, *NetworkAssociateRequest) (*NetworkAssociateResponse, error)
 	Dissociate(context.Context, *NetworkDissociateRequest) (*NetworkDissociateResponse, error)
 }
@@ -457,6 +531,24 @@ func _NetworkService_GetAllTypes_Handler(srv interface{}, ctx context.Context, d
 	return interceptor(ctx, in, info, handler)
 }
 
+func _NetworkService_GetAssociatedUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(NetworkGetAssociatedUsersRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(NetworkServiceServer).GetAssociatedUsers(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/pb.NetworkService/GetAssociatedUsers",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(NetworkServiceServer).GetAssociatedUsers(ctx, req.(*NetworkGetAssociatedUsersRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _NetworkService_Associate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(NetworkAssociateRequest)
 	if err := dec(in); err != nil {
@@ -513,6 +605,10 @@ var _NetworkService_serviceDesc = grpc.ServiceDesc{
 			MethodName: "GetAllTypes",
 			Handler:    _NetworkService_GetAllTypes_Handler,
 		},
+		{
+			MethodName: "GetAssociatedUsers",
+			Handler:    _NetworkService_GetAssociatedUsers_Handler,
+		},
 		{
 			MethodName: "Associate",
 			Handler:    _NetworkService_Associate_Handler,
@@ -529,33 +625,38 @@ var _NetworkService_serviceDesc = grpc.ServiceDesc{
 func init() { proto.RegisterFile("network.proto", fileDescriptor2) }
 
 var fileDescriptor2 = []byte{
-	// 447 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08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 0x8d, 0x03, 0x5c, 0x5f,
-	0x1d, 0x81, 0x23, 0x4d, 0xcb, 0x68, 0x67, 0x36, 0x2a, 0xa3, 0x9d, 0x75, 0x98, 0x16, 0xd0, 0x1c,
-	0xaa, 0x86, 0x6b, 0xa8, 0x63, 0xc4, 0x1e, 0xee, 0x1a, 0xf9, 0x72, 0x8c, 0xd6, 0xf9, 0xfe, 0x80,
-	0xab, 0x1d, 0x45, 0x2d, 0x23, 0x7c, 0x7f, 0x39, 0x49, 0x3b, 0x9f, 0xd4, 0x99, 0xfe, 0x01, 0xec,
-	0xfc, 0x47, 0x66, 0xf4, 0xc1, 0x72, 0x92, 0xce, 0x11, 0x36, 0x4d, 0xb6, 0x74, 0x92, 0x9f, 0xde,
-	0xcf, 0xe7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xb3, 0x16, 0xc9, 0x05, 0x05, 0x00, 0x00,
+	// 519 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x5d, 0x6f, 0xd3, 0x30,
+	0x14, 0x5d, 0xd6, 0xae, 0x2c, 0x37, 0xe2, 0x43, 0x77, 0x83, 0x65, 0x5e, 0x87, 0x82, 0xc5, 0xc4,
+	0xc4, 0x43, 0x85, 0x86, 0x84, 0xc4, 0xcb, 0xa6, 0xaa, 0x95, 0x60, 0x80, 0xfa, 0x10, 0x3e, 0xde,
+	0xfb, 0xe1, 0x87, 0x88, 0xd2, 0x84, 0x38, 0x80, 0xf8, 0x29, 0xfc, 0x02, 0xfe, 0x26, 0x72, 0x7c,
+	0xed, 0x38, 0x4d, 0xd6, 0x09, 0xf5, 0xcd, 0x3d, 0xc7, 0x3e, 0xe7, 0x24, 0xe7, 0xc6, 0x85, 0xbb,
+	0x2b, 0x51, 0xfc, 0x4a, 0xf3, 0xaf, 0x83, 0x2c, 0x4f, 0x8b, 0x14, 0x77, 0xb3, 0x19, 0x5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 0x7c, 0xb7, 0xf8, 0x74, 0xed, 0x5c, 0xeb, 0xf7,
+	0xcd, 0xce, 0x6e, 0xd9, 0x65, 0x4d, 0xde, 0x82, 0x6f, 0x49, 0x3c, 0x71, 0x4e, 0xad, 0x5f, 0x69,
+	0xac, 0xdf, 0x4e, 0x5a, 0xa5, 0xf7, 0x00, 0xd5, 0x9c, 0xa0, 0xbb, 0xbb, 0x71, 0xa5, 0xb1, 0xd3,
+	0x1b, 0x58, 0x23, 0x36, 0xeb, 0x95, 0x7f, 0x15, 0x2f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x97,
+	0x70, 0x5d, 0x7b, 0x3b, 0x06, 0x00, 0x00,
 }

+ 14 - 1
pb/network.proto

@@ -21,11 +21,16 @@ message NetworkDissociateRequest {
   string Name = 1;
   string Username = 2;
 }
+
+message NetworkGetAssociatedUsersRequest {
+  string Name = 1;
+}
 service NetworkService {
   rpc Create (NetworkCreateRequest) returns (NetworkCreateResponse) {}
   rpc List (NetworkListRequest) returns (NetworkListResponse) {}
   rpc Delete (NetworkDeleteRequest) returns (NetworkDeleteResponse) {}
   rpc GetAllTypes(NetworkGetAllTypesRequest) returns (NetworkGetAllTypesResponse) {}
+  rpc GetAssociatedUsers(NetworkGetAssociatedUsersRequest) returns (NetworkGetAssociatedUsersResponse) {}
   rpc Associate (NetworkAssociateRequest) returns (NetworkAssociateResponse) {}
   rpc Dissociate (NetworkDissociateRequest) returns (NetworkDissociateResponse) {}
 }
@@ -37,6 +42,11 @@ message Network {
   repeated string AssociatedUsernames = 5;
   string Via = 6;
 }
+
+message NetworkType {
+  string Type = 1;
+  string Description = 2;
+}
 message NetworkCreateResponse {
   Network Network = 1;
 }
@@ -47,7 +57,10 @@ message NetworkDeleteResponse {
   Network Network = 1;
 }
 message NetworkGetAllTypesResponse {
-  repeated string Types = 1;
+  repeated NetworkType Types = 1;
 }
 message NetworkAssociateResponse {}
 message NetworkDissociateResponse {}
+message NetworkGetAssociatedUsersResponse {
+  repeated string Usernames = 1;
+}

+ 3 - 0
pb/user.pb.go

@@ -28,13 +28,16 @@ It has these top-level messages:
 	NetworkGetAllTypesRequest
 	NetworkAssociateRequest
 	NetworkDissociateRequest
+	NetworkGetAssociatedUsersRequest
 	Network
+	NetworkType
 	NetworkCreateResponse
 	NetworkListResponse
 	NetworkDeleteResponse
 	NetworkGetAllTypesResponse
 	NetworkAssociateResponse
 	NetworkDissociateResponse
+	NetworkGetAssociatedUsersResponse
 */
 package pb