NewServerWithServeFunc return a new Server.
(f ServeStream)
| 55 | |
| 56 | // NewServerWithServeFunc return a new Server. |
| 57 | func NewServerWithServeFunc(f ServeStream) *Server { |
| 58 | ctx, cancel := context.WithCancel(context.Background()) |
| 59 | return &Server{ |
| 60 | ctx: ctx, |
| 61 | cancel: cancel, |
| 62 | rpcServer: rpc.NewServer(), |
| 63 | acceptConn: AcceptNAConn, |
| 64 | serveStream: f, |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // InitRPCServer load the private key, init the crypto transfer layer and register RPC |
| 69 | // services. |