whitelist

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2019 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Whitelist Plugin

The whitelist plugin is a plugin for micro which whitelists the services that can be used via the /rpc HTTP endpoint.

Usage

Register the plugin before building Micro

package main

import (
	"github.com/micro/micro/plugin"
	"github.com/micro/go-plugins/micro/whitelist"
)

func init() {
	plugin.Register(whitelist.NewRPCWhitelist())
}

It can then be applied on the command line like so.

micro --rpc_whitelist go.micro.srv.greeter,go.micro.srv.example api
Scoped to API

If you like to only apply the plugin for a specific component you can register it with that specifically. For example, below you'll see the plugin registered with the API.

package main

import (
	"github.com/micro/micro/api"
	"github.com/micro/go-plugins/micro/whitelist"
)

func init() {
	api.Register(whitelist.NewRPCWhitelist())
}

Here's what the help displays when you do that.

$ go run main.go link.go api --help
NAME:
   main api - Run the micro API

USAGE:
   main api [command options] [arguments...]

OPTIONS:
   --rpc_whitelist 	Comma separated whitelist of allowed services for RPC calls [$MICRO_RPC_WHITELIST]

In this case the usage would be

micro api --rpc_whitelist go.micro.srv.greeter

Documentation

Overview

Package whitelist is a micro plugin for whitelisting service requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlugin added in v0.17.1

func NewPlugin() plugin.Plugin

func NewRPCWhitelist

func NewRPCWhitelist(services ...string) plugin.Plugin

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL