mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
24 lines
386 B
Go
24 lines
386 B
Go
package rpc
|
|
|
|
import (
|
|
"net"
|
|
"net/rpc"
|
|
)
|
|
|
|
type Client struct {
|
|
*rpc.Client
|
|
}
|
|
|
|
// New returns a new, remote datastore backend that connects
|
|
// via tcp and exchanges data using Go's RPC mechanism.
|
|
func New(address string) (*Client, error) {
|
|
conn, err := net.Dial("tcp", address)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
client := &Client{
|
|
rpc.NewClient(conn),
|
|
}
|
|
return client, nil
|
|
}
|