aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-14 07:25:33 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-14 07:25:33 +0800
commit28b14d3e6d43cb27019e21d0a93a80e7bee1de8c (patch)
tree9995026e87221a80cb5171364ffa734459c16b16 /cmd/utils/flags.go
parent73c4e6005c3e47342a4631955ca6fd2782925886 (diff)
parentf9cbd16f27e393d4937354ee31435e0a2f689484 (diff)
downloadgo-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar
go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.gz
go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.bz2
go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.lz
go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.xz
go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.zst
go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.zip
Merge pull request #1635 from bas-vk/useragent
support for user agents
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go25
1 files changed, 16 insertions, 9 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index f9bc3ed4d..af2929d10 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -21,30 +21,32 @@ import (
"fmt"
"log"
"math/big"
+ "net"
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
- "github.com/ethereum/go-ethereum/core/vm"
- "github.com/ethereum/go-ethereum/metrics"
-
"github.com/codegangsta/cli"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
+ "github.com/ethereum/go-ethereum/rpc/shared"
+ "github.com/ethereum/go-ethereum/rpc/useragent"
"github.com/ethereum/go-ethereum/xeth"
)
@@ -518,15 +520,20 @@ func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error {
Endpoint: IpcSocketPath(ctx),
}
- xeth := xeth.New(eth, nil)
- codec := codec.JSON
+ initializer := func(conn net.Conn) (shared.EthereumApi, error) {
+ fe := useragent.NewRemoteFrontend(conn, eth.AccountManager())
+ xeth := xeth.New(eth, fe)
+ codec := codec.JSON
- apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth)
- if err != nil {
- return err
+ apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth)
+ if err != nil {
+ return nil, err
+ }
+
+ return api.Merge(apis...), nil
}
- return comms.StartIpc(config, codec, api.Merge(apis...))
+ return comms.StartIpc(config, codec.JSON, initializer)
}
func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error {