mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
c30188552f
This makes it possible to send wsh commands from wsh on a remote session to wavesrv running locally. The exact behavior of running those commands isn't implemented, but the underlying interface is added here.
30 lines
730 B
Go
30 lines
730 B
Go
// Copyright 2024, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package wshserver
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/wavetermdev/thenextwave/pkg/wshrpc"
|
|
"github.com/wavetermdev/thenextwave/pkg/wshutil"
|
|
)
|
|
|
|
const (
|
|
DefaultOutputChSize = 32
|
|
DefaultInputChSize = 32
|
|
)
|
|
|
|
var waveSrvClient_Singleton *wshutil.WshRpc
|
|
var waveSrvClient_Once = &sync.Once{}
|
|
|
|
// returns the wavesrv main rpc client singleton
|
|
func GetMainRpcClient() *wshutil.WshRpc {
|
|
waveSrvClient_Once.Do(func() {
|
|
inputCh := make(chan []byte, DefaultInputChSize)
|
|
outputCh := make(chan []byte, DefaultOutputChSize)
|
|
waveSrvClient_Singleton = wshutil.MakeWshRpc(inputCh, outputCh, wshrpc.RpcContext{}, &WshServerImpl)
|
|
})
|
|
return waveSrvClient_Singleton
|
|
}
|