Documentation ¶
Overview ¶
Package auth is a plugin for verifying peer at the first time.
Copyright 2017 HenryLee. All Rights Reserved.
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MultiRecvErr = tp.NewStatus( tp.CodeInternalServerError, "auth-checker plugin usage is incorrect", "multiple call RecvOnce function", )
MultiRecvErr the error of multiple call RecvOnce function
var MultiSendErr = tp.NewStatus( tp.CodeWriteFailed, "auth-bearer plugin usage is incorrect", "multiple call SendOnce function", )
MultiSendErr the error of multiple call SendOnce function
Functions ¶
func NewBearerPlugin ¶
func NewBearerPlugin(fn Bearer, infoSetting ...tp.MessageSetting) tp.Plugin
NewBearerPlugin creates a auth bearer plugin for client.
func NewCheckerPlugin ¶
func NewCheckerPlugin(fn Checker, retSetting ...tp.MessageSetting) tp.Plugin
NewCheckerPlugin creates a auth checker plugin for server.
Types ¶
type Session ¶
type Session interface { // Peer returns the peer. Peer() tp.Peer // SetID sets the session id. SetID(newID string) // LocalAddr returns the local network address. LocalAddr() net.Addr // RemoteAddr returns the remote network address. RemoteAddr() net.Addr // Swap returns custom data swap of the session(socket). Swap() goutil.Map }
Session auth session provides SetID, RemoteAddr and Swap methods in base session