pbin

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

(C) Copyright 2019-2020 Intel Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.

(C) Copyright 2020 Intel Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.

(C) Copyright 2019-2020 Intel Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.

(C) Copyright 2019-2020 Intel Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.

(C) Copyright 2019-2020 Intel Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.

Index

Constants

View Source
const (
	// MessageBufferSize is the starting size of the receive buffer. If
	// the buffer must be grown to accommodate larger messages, it is
	// expanded in increments of this value.
	MessageBufferSize = 1024
	// MaxMessageSize is the largest single message that can be written to
	// or read from the privileged binary.
	MaxMessageSize = MessageBufferSize * 1024
)
View Source
const (
	// DaosAdminName is the name of the daos_admin privileged helper.
	DaosAdminName = "daos_admin"

	// DaosAdminLogFileEnvVar is the name of the environment variable which
	// can be set to enable non-ERROR logging in the privileged binary.
	DaosAdminLogFileEnvVar = "DAOS_ADMIN_LOG_FILE"
)

Variables

This section is empty.

Functions

func CheckHelper added in v0.9.1

func CheckHelper(log logging.Logger, helperName string) error

CheckHelper attempts to invoke the helper to test for installation/setup problems. This function can be used to proactively identify problems and avoid console spam from multiple errors.

func PrivilegedHelperNotAvailable added in v0.9.1

func PrivilegedHelperNotAvailable(helperName string) *fault.Fault

func PrivilegedHelperNotPrivileged added in v0.9.1

func PrivilegedHelperNotPrivileged(helperName string) *fault.Fault

func PrivilegedHelperRequestFailed added in v0.9.1

func PrivilegedHelperRequestFailed(message string) *fault.Fault

func ReadMessage added in v0.9.1

func ReadMessage(conn io.Reader) ([]byte, error)

ReadMessage attempts to read a message from the sender and returns a buffer containing the message if successful. Relies on the writer being closed so that the reader gets an io.EOF to signal that the message is complete.

Types

type ForwardChecker added in v0.9.0

type ForwardChecker interface {
	IsForwarded() bool
}

ForwardChecker defines an interface for any request that could have been forwarded.

type ForwardableRequest added in v0.9.0

type ForwardableRequest struct {
	Forwarded bool
}

ForwardableRequest is intended to be embedded into request types that can be forwarded to the privileged binary.

func (ForwardableRequest) IsForwarded added in v0.9.0

func (r ForwardableRequest) IsForwarded() bool

IsForwarded implements the ForwardChecker interface.

type Forwarder added in v0.9.0

type Forwarder struct {
	Disabled bool
	// contains filtered or unexported fields
}

Forwarder provides a common implementation of a request forwarder.

func NewForwarder added in v0.9.0

func NewForwarder(log logging.Logger, pbinName string) *Forwarder

NewForwarder returns a configured *Forwarder.

func (*Forwarder) SendReq added in v0.9.0

func (f *Forwarder) SendReq(method string, fwdReq interface{}, fwdRes interface{}) error

SendReq is responsible for marshaling the forwarded request into a message that is sent to the privileged binary, then unmarshaling the response for the caller.

type Request

type Request struct {
	Method  string
	Payload json.RawMessage
}

Request represents a request sent to the privileged binary. The payload field contains a JSON-encoded representation of the wrapped request.

type Response

type Response struct {
	Error   *fault.Fault
	Payload json.RawMessage
}

Response represents a response received from the privileged binary. The payload field contains a JSON-encoded representation of the wrapped response.

func ExecReq

func ExecReq(parent context.Context, log logging.Logger, binPath string, req *Request) (res *Response, err error)

ExecReq executes the supplied Request by starting a child process to service the request. Returns a Response if successful.

type StdioAddr

type StdioAddr struct {
	// contains filtered or unexported fields
}

StdioAddr implements net.Addr to provide an emulated network address for use with StdioConn.

func (*StdioAddr) Network

func (s *StdioAddr) Network() string

func (*StdioAddr) String

func (s *StdioAddr) String() string

type StdioConn

type StdioConn struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

StdioConn implements net.Conn to provide an emulated network connection between two processes over stdin/stdout.

func NewStdioConn

func NewStdioConn(localID, remoteID string, in io.ReadCloser, out io.WriteCloser) *StdioConn

func (*StdioConn) Close

func (sc *StdioConn) Close() error

func (*StdioConn) CloseRead added in v0.9.1

func (sc *StdioConn) CloseRead() error

func (*StdioConn) CloseWrite added in v0.9.1

func (sc *StdioConn) CloseWrite() error

func (*StdioConn) LocalAddr

func (sc *StdioConn) LocalAddr() net.Addr

func (*StdioConn) Read

func (sc *StdioConn) Read(b []byte) (int, error)

func (*StdioConn) RemoteAddr

func (sc *StdioConn) RemoteAddr() net.Addr

func (*StdioConn) SetDeadline

func (sc *StdioConn) SetDeadline(t time.Time) error

func (*StdioConn) SetReadDeadline

func (sc *StdioConn) SetReadDeadline(t time.Time) error

func (*StdioConn) SetWriteDeadline

func (sc *StdioConn) SetWriteDeadline(t time.Time) error

func (*StdioConn) String

func (sc *StdioConn) String() string

func (*StdioConn) Write

func (sc *StdioConn) Write(b []byte) (int, error)

type StdioListener

type StdioListener struct {
	// contains filtered or unexported fields
}

StdioListener wraps a *StdioConn to implement net.Listener.

func NewStdioListener

func NewStdioListener(conn *StdioConn) *StdioListener

func (*StdioListener) Accept

func (sl *StdioListener) Accept() (net.Conn, error)

func (*StdioListener) Addr

func (sl *StdioListener) Addr() net.Addr

func (*StdioListener) Close

func (sl *StdioListener) Close() error

Jump to

Keyboard shortcuts

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