diff --git a/cmd/utils/input.go b/cmd/utils/input.go new file mode 100644 index 0000000000..40ec32bac9 --- /dev/null +++ b/cmd/utils/input.go @@ -0,0 +1,113 @@ +// Copyright 2016 The go-ethereum Authors +// This file is part of go-ethereum. +// +// go-ethereum is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// go-ethereum is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with go-ethereum. If not, see . + +package utils + +import ( + "fmt" + + "github.com/ethereum/go-ethereum/accounts" + // "strings" + "github.com/ethereum/go-ethereum/console" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" + "gopkg.in/urfave/cli.v1" + // "github.com/peterh/liner" +) + +// tries unlocking the specified account a few times. +func UnlockAccount(ctx *cli.Context, accman *accounts.Manager, address string, i int, passwords []string) (accounts.Account, string) { + account, err := MakeAddress(accman, address) + if err != nil { + Fatalf("Could not list accounts: %v", err) + } + for trials := 0; trials < 3; trials++ { + prompt := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", address, trials+1, 3) + password := GetPassPhrase(prompt, false, i, passwords) + err = accman.Unlock(account, password) + if err == nil { + glog.V(logger.Info).Infof("Unlocked account %x", account.Address) + return account, password + } + if err, ok := err.(*accounts.AmbiguousAddrError); ok { + glog.V(logger.Info).Infof("Unlocked account %x", account.Address) + return AmbiguousAddrRecovery(accman, err, password), password + } + if err != accounts.ErrDecrypt { + // No need to prompt again if the error is not decryption-related. + break + } + } + // All trials expended to unlock account, bail out + Fatalf("Failed to unlock account %s (%v)", address, err) + return accounts.Account{}, "" +} + +// getPassPhrase retrieves the passwor associated with an account, either fetched +// from a list of preloaded passphrases, or requested interactively from the user. +func GetPassPhrase(prompt string, confirmation bool, i int, passwords []string) string { + // If a list of passwords was supplied, retrieve from them + if len(passwords) > 0 { + if i < len(passwords) { + return passwords[i] + } + return passwords[len(passwords)-1] + } + // Otherwise prompt the user for the password + if prompt != "" { + fmt.Println(prompt) + } + password, err := console.Stdin.PromptPassword("Passphrase: ") + if err != nil { + Fatalf("Failed to read passphrase: %v", err) + } + if confirmation { + confirm, err := console.Stdin.PromptPassword("Repeat passphrase: ") + if err != nil { + Fatalf("Failed to read passphrase confirmation: %v", err) + } + if password != confirm { + Fatalf("Passphrases do not match") + } + } + return password +} + +func AmbiguousAddrRecovery(am *accounts.Manager, err *accounts.AmbiguousAddrError, auth string) accounts.Account { + fmt.Printf("Multiple key files exist for address %x:\n", err.Addr) + for _, a := range err.Matches { + fmt.Println(" ", a.File) + } + fmt.Println("Testing your passphrase against all of them...") + var match *accounts.Account + for _, a := range err.Matches { + if err := am.Unlock(a, auth); err == nil { + match = &a + break + } + } + if match == nil { + Fatalf("None of the listed files could be unlocked.") + } + fmt.Printf("Your passphrase unlocked %s\n", match.File) + fmt.Println("In order to avoid this warning, you need to remove the following duplicate key files:") + for _, a := range err.Matches { + if a != *match { + fmt.Println(" ", a.File) + } + } + return *match +} diff --git a/swarm/network/depo.go b/swarm/network/depo.go index 3b91920f03..97061fe29e 100644 --- a/swarm/network/depo.go +++ b/swarm/network/depo.go @@ -112,7 +112,7 @@ func (self *Depo) HandleStoreRequestMsg(req *storeRequestMsgData, p *peer) { } // update chunk with size and data - chunk.SData = req.SData + chunk.SData = req.SData // protocol validates that SData is minimum 9 bytes long (int64 size + at least one byte of data) chunk.Size = int64(binary.LittleEndian.Uint64(req.SData[0:8])) glog.V(logger.Detail).Infof("[BZZ] delivery of %p from %v", chunk, p) chunk.Source = p @@ -136,7 +136,7 @@ func (self *Depo) HandleRetrieveRequestMsg(req *retrieveRequestMsgData, p *peer) // call storage.NetStore#Get which // blocks until local retrieval finished - // launches cloud retrieval in a separate go routine + // launches cloud retrieval chunk, _ := self.netStore.Get(req.Key) req = self.strategyUpdateRequest(chunk.Req, req) // check if we can immediately deliver diff --git a/swarm/network/protocol.go b/swarm/network/protocol.go index 7ba7755e34..7e45fde094 100644 --- a/swarm/network/protocol.go +++ b/swarm/network/protocol.go @@ -226,6 +226,9 @@ func (self *bzz) handle() error { if err := msg.Decode(&req); err != nil { return self.protoError(ErrDecode, "<- %v: %v", msg, err) } + if len(req.SData) < 9 { + return self.protoError(ErrDecode, "<- %v: Data too short (%v)", msg) + } glog.V(logger.Detail).Infof("[BZZ] incoming store request: %s", req.String()) // swap accounting is done within forwarding self.storage.HandleStoreRequestMsg(&req, &peer{bzz: self}) diff --git a/swarm/services/ens/README.md b/swarm/services/ens/README.md new file mode 100644 index 0000000000..8c690af5a6 --- /dev/null +++ b/swarm/services/ens/README.md @@ -0,0 +1,23 @@ +# Swarm ENS interface + +The ABI and BIN files in contract subdirectory implement simple registrar and personal resolver contracts; they're used in tests, and can be used to deploy these contracts for your own purposes. + +The solidity source code can be found at [github.com/arachnid/ens/](https://github.com/arachnid/ens/). + +The ABI and BIN files in the contract subdirectory were generated by + +```shell +solc -o `pwd` --optimise --abi --bin OpenRegistrar.sol +solc -o `pwd` --optimise --abi --bin PersonalResolver.sol +``` + +using the .sol files in [revision 8b38b23a23100d5c325ae3fa24935f5ab93d61ba](https://github.com/Arachnid/ens/commit/8b38b23a23100d5c325ae3fa24935f5ab93d61ba) +with solc version 0.3.5-0/RelWithDebInfo-Linux/g++/Interpreter + +The go bindings for ENS contracts are generated using `abigen` via the go generator: + +```shell +godep go generate ./swarm/services/ens +``` + +see the preprocessor directives in leading comments of ens.go and ens_test.go \ No newline at end of file diff --git a/swarm/services/ens/contract/OpenRegistrar.abi b/swarm/services/ens/contract/OpenRegistrar.abi new file mode 100644 index 0000000000..1b48192597 --- /dev/null +++ b/swarm/services/ens/contract/OpenRegistrar.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"register","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"setResolver","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"label","type":"bytes32"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"}] diff --git a/swarm/services/ens/contract/OpenRegistrar.bin b/swarm/services/ens/contract/OpenRegistrar.bin new file mode 100644 index 0000000000..0c2136d01a --- /dev/null +++ b/swarm/services/ens/contract/OpenRegistrar.bin @@ -0,0 +1 @@ +60606040526103b1806100126000396000f3606060405236156100615760e060020a60003504635b0fc9c381146100635780638021061c14610085578063a16fdafa146100a2578063a1f8f8f0146100d5578063a9f2a1b2146100fa578063deb931a21461011f578063edc0277c14610145575b005b610061600435602435600081600160a060020a03166000141561028157610002565b6101956004356000606081905260a060405260809081525b919050565b610203600435602435604435600080808080600160a060020a0319881681146100ca57600394505b939792965093509350565b610061600435602435604435600082600160a060020a0316600014156102c157610002565b610061600435602435604435600082600160a060020a03166000141561033657610002565b610229600435600081815260208190526040902060010154600160a060020a031661009d565b6102466004356024356000818152602081905260408120819081908190600160a060020a031987168214158061018757506001810154600160a060020a031682145b1561038957600394506103a7565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b50505061ffff919091166060908152608082905260a082815260c083905260e092909252f35b60408051600160a060020a03929092168252519081900360200190f35b61ffff93909316606090815263ffffffff929092166080908152600160a060020a03199190911660a052600160a060020a039290921660c052f35b828152602081905260409020600181015433600160a060020a039081169116146102aa57610002565b6001018054600160a060020a031916909117905550565b83815260208190526040812060018101549091600160a060020a03909116146102e957610002565b60018101805460c0604052606085905260808490523360a08190528354600160a060020a03199081168717600160a060020a031660a060020a808804021785559190911617905550505050565b838152602081905260409020600181015433600160a060020a0390811691161461035f57610002565b8054600160a060020a031916909217600160a060020a031660a060020a9182900490910217905550565b8054610e10945060a060020a808204029350600160a060020a031691505b509295919450925056 \ No newline at end of file diff --git a/swarm/services/ens/contract/OpenRegistrar.go b/swarm/services/ens/contract/OpenRegistrar.go new file mode 100644 index 0000000000..a6ed38d37a --- /dev/null +++ b/swarm/services/ens/contract/OpenRegistrar.go @@ -0,0 +1,366 @@ +// This file is an automatically generated Go binding. Do not modify as any +// change will likely be lost upon the next re-generation! + +package contract + +import ( + "strings" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +// OpenRegistrarABI is the input ABI used to generate the binding from. +const OpenRegistrarABI = `[{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"register","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"label","type":"bytes32"},{"name":"resolver","type":"address"},{"name":"nodeId","type":"bytes12"}],"name":"setResolver","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"label","type":"bytes32"}],"name":"getOwner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"}]` + +// OpenRegistrarBin is the compiled bytecode used for deploying new contracts. +const OpenRegistrarBin = `606060405261083b806100126000396000f36060604052361561007f576000357c0100000000000000000000000000000000000000000000000000000000900480635b0fc9c3146100815780638021061c146100a2578063a16fdafa14610126578063a1f8f8f0146101a5578063a9f2a1b2146101cf578063deb931a2146101f9578063edc0277c1461023b5761007f565b005b6100a060048080359060200190919080359060200190919050506102bc565b005b6100b86004808035906020019091905050610392565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61014e60048080359060200190919080359060200190919080359060200190919050506103c6565b604051808661ffff168152602001856fffffffffffffffffffffffffffffffff191681526020018463ffffffff1681526020018361ffff168152602001826000191681526020019550505050505060405180910390f35b6101cd600480803590602001909190803590602001909190803590602001909190505061041f565b005b6101f760048080359060200190919080359060200190919080359060200190919050506105ac565b005b61020f60048080359060200190919050506106c0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61025a600480803590602001909190803590602001909190505061070f565b604051808561ffff1681526020018463ffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff191681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b600060008273ffffffffffffffffffffffffffffffffffffffff1614156102e257610002565b600060005060008460001916815260200190815260200160002060005090503373ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561035f57610002565b818160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b505050565b6020604051908101604052806000815260200150602060405190810160405280600081526020015090506103c1565b919050565b60006000600060006000600074010000000000000000000000000000000000000000028873ffffffffffffffffffffffffffffffffffffffff191614151561041357600394508450610414565b5b939792965093509350565b600060008373ffffffffffffffffffffffffffffffffffffffff16141561044557610002565b60006000506000856000191681526020019081526020016000206000509050600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156104c357610002565b60606040519081016040528084815260200183815260200133815260200150600060005060008660001916815260200190815260200160002060005060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff0219169083021790555060208201518160000160146101000a8154816bffffffffffffffffffffffff0219169083740100000000000000000000000000000000000000009004021790555060408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055509050505b50505050565b600060008373ffffffffffffffffffffffffffffffffffffffff1614156105d257610002565b600060005060008560001916815260200190815260200160002060005090503373ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561064f57610002565b828160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550818160000160146101000a8154816bffffffffffffffffffffffff021916908374010000000000000000000000000000000000000000900402179055505b50505050565b6000600060005060008360001916815260200190815260200160002060005060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061070a565b919050565b6000600060006000600060006000506000876000191681526020019081526020016000206000509050600074010000000000000000000000000000000000000000028773ffffffffffffffffffffffffffffffffffffffff19161415806107c65750600073ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156107d657600394508450610831565b610e10935083508060000160149054906101000a90047401000000000000000000000000000000000000000002925082508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915081505b509295919450925056` + +// DeployOpenRegistrar deploys a new Ethereum contract, binding an instance of OpenRegistrar to it. +func DeployOpenRegistrar(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *OpenRegistrar, error) { + parsed, err := abi.JSON(strings.NewReader(OpenRegistrarABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(OpenRegistrarBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &OpenRegistrar{OpenRegistrarCaller: OpenRegistrarCaller{contract: contract}, OpenRegistrarTransactor: OpenRegistrarTransactor{contract: contract}}, nil +} + +// OpenRegistrar is an auto generated Go binding around an Ethereum contract. +type OpenRegistrar struct { + OpenRegistrarCaller // Read-only binding to the contract + OpenRegistrarTransactor // Write-only binding to the contract +} + +// OpenRegistrarCaller is an auto generated read-only Go binding around an Ethereum contract. +type OpenRegistrarCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// OpenRegistrarTransactor is an auto generated write-only Go binding around an Ethereum contract. +type OpenRegistrarTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// OpenRegistrarSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type OpenRegistrarSession struct { + Contract *OpenRegistrar // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// OpenRegistrarCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type OpenRegistrarCallerSession struct { + Contract *OpenRegistrarCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// OpenRegistrarTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type OpenRegistrarTransactorSession struct { + Contract *OpenRegistrarTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// OpenRegistrarRaw is an auto generated low-level Go binding around an Ethereum contract. +type OpenRegistrarRaw struct { + Contract *OpenRegistrar // Generic contract binding to access the raw methods on +} + +// OpenRegistrarCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type OpenRegistrarCallerRaw struct { + Contract *OpenRegistrarCaller // Generic read-only contract binding to access the raw methods on +} + +// OpenRegistrarTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type OpenRegistrarTransactorRaw struct { + Contract *OpenRegistrarTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewOpenRegistrar creates a new instance of OpenRegistrar, bound to a specific deployed contract. +func NewOpenRegistrar(address common.Address, backend bind.ContractBackend) (*OpenRegistrar, error) { + contract, err := bindOpenRegistrar(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) + if err != nil { + return nil, err + } + return &OpenRegistrar{OpenRegistrarCaller: OpenRegistrarCaller{contract: contract}, OpenRegistrarTransactor: OpenRegistrarTransactor{contract: contract}}, nil +} + +// NewOpenRegistrarCaller creates a new read-only instance of OpenRegistrar, bound to a specific deployed contract. +func NewOpenRegistrarCaller(address common.Address, caller bind.ContractCaller) (*OpenRegistrarCaller, error) { + contract, err := bindOpenRegistrar(address, caller, nil) + if err != nil { + return nil, err + } + return &OpenRegistrarCaller{contract: contract}, nil +} + +// NewOpenRegistrarTransactor creates a new write-only instance of OpenRegistrar, bound to a specific deployed contract. +func NewOpenRegistrarTransactor(address common.Address, transactor bind.ContractTransactor) (*OpenRegistrarTransactor, error) { + contract, err := bindOpenRegistrar(address, nil, transactor) + if err != nil { + return nil, err + } + return &OpenRegistrarTransactor{contract: contract}, nil +} + +// bindOpenRegistrar binds a generic wrapper to an already deployed contract. +func bindOpenRegistrar(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(OpenRegistrarABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_OpenRegistrar *OpenRegistrarRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _OpenRegistrar.Contract.OpenRegistrarCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_OpenRegistrar *OpenRegistrarRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _OpenRegistrar.Contract.OpenRegistrarTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_OpenRegistrar *OpenRegistrarRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _OpenRegistrar.Contract.OpenRegistrarTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_OpenRegistrar *OpenRegistrarCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _OpenRegistrar.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_OpenRegistrar *OpenRegistrarTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _OpenRegistrar.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_OpenRegistrar *OpenRegistrarTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _OpenRegistrar.Contract.contract.Transact(opts, method, params...) +} + +// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// +// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) +func (_OpenRegistrar *OpenRegistrarCaller) FindResolver(opts *bind.CallOpts, nodeId [12]byte, label [32]byte) (struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address +}, error) { + ret := new(struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address + }) + out := ret + err := _OpenRegistrar.contract.Call(opts, out, "findResolver", nodeId, label) + return *ret, err +} + +// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// +// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) +func (_OpenRegistrar *OpenRegistrarSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address +}, error) { + return _OpenRegistrar.Contract.FindResolver(&_OpenRegistrar.CallOpts, nodeId, label) +} + +// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// +// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) +func (_OpenRegistrar *OpenRegistrarCallerSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address +}, error) { + return _OpenRegistrar.Contract.FindResolver(&_OpenRegistrar.CallOpts, nodeId, label) +} + +// GetExtended is a free data retrieval call binding the contract method 0x8021061c. +// +// Solidity: function getExtended(id bytes32) constant returns(data bytes) +func (_OpenRegistrar *OpenRegistrarCaller) GetExtended(opts *bind.CallOpts, id [32]byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _OpenRegistrar.contract.Call(opts, out, "getExtended", id) + return *ret0, err +} + +// GetExtended is a free data retrieval call binding the contract method 0x8021061c. +// +// Solidity: function getExtended(id bytes32) constant returns(data bytes) +func (_OpenRegistrar *OpenRegistrarSession) GetExtended(id [32]byte) ([]byte, error) { + return _OpenRegistrar.Contract.GetExtended(&_OpenRegistrar.CallOpts, id) +} + +// GetExtended is a free data retrieval call binding the contract method 0x8021061c. +// +// Solidity: function getExtended(id bytes32) constant returns(data bytes) +func (_OpenRegistrar *OpenRegistrarCallerSession) GetExtended(id [32]byte) ([]byte, error) { + return _OpenRegistrar.Contract.GetExtended(&_OpenRegistrar.CallOpts, id) +} + +// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. +// +// Solidity: function getOwner(label bytes32) constant returns(address) +func (_OpenRegistrar *OpenRegistrarCaller) GetOwner(opts *bind.CallOpts, label [32]byte) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _OpenRegistrar.contract.Call(opts, out, "getOwner", label) + return *ret0, err +} + +// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. +// +// Solidity: function getOwner(label bytes32) constant returns(address) +func (_OpenRegistrar *OpenRegistrarSession) GetOwner(label [32]byte) (common.Address, error) { + return _OpenRegistrar.Contract.GetOwner(&_OpenRegistrar.CallOpts, label) +} + +// GetOwner is a free data retrieval call binding the contract method 0xdeb931a2. +// +// Solidity: function getOwner(label bytes32) constant returns(address) +func (_OpenRegistrar *OpenRegistrarCallerSession) GetOwner(label [32]byte) (common.Address, error) { + return _OpenRegistrar.Contract.GetOwner(&_OpenRegistrar.CallOpts, label) +} + +// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// +// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) +func (_OpenRegistrar *OpenRegistrarCaller) Resolve(opts *bind.CallOpts, nodeId [12]byte, qtype [32]byte, index uint16) (struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte +}, error) { + ret := new(struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte + }) + out := ret + err := _OpenRegistrar.contract.Call(opts, out, "resolve", nodeId, qtype, index) + return *ret, err +} + +// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// +// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) +func (_OpenRegistrar *OpenRegistrarSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte +}, error) { + return _OpenRegistrar.Contract.Resolve(&_OpenRegistrar.CallOpts, nodeId, qtype, index) +} + +// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// +// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) +func (_OpenRegistrar *OpenRegistrarCallerSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte +}, error) { + return _OpenRegistrar.Contract.Resolve(&_OpenRegistrar.CallOpts, nodeId, qtype, index) +} + +// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. +// +// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() +func (_OpenRegistrar *OpenRegistrarTransactor) Register(opts *bind.TransactOpts, label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { + return _OpenRegistrar.contract.Transact(opts, "register", label, resolver, nodeId) +} + +// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. +// +// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() +func (_OpenRegistrar *OpenRegistrarSession) Register(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { + return _OpenRegistrar.Contract.Register(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) +} + +// Register is a paid mutator transaction binding the contract method 0xa1f8f8f0. +// +// Solidity: function register(label bytes32, resolver address, nodeId bytes12) returns() +func (_OpenRegistrar *OpenRegistrarTransactorSession) Register(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { + return _OpenRegistrar.Contract.Register(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. +// +// Solidity: function setOwner(label bytes32, newOwner address) returns() +func (_OpenRegistrar *OpenRegistrarTransactor) SetOwner(opts *bind.TransactOpts, label [32]byte, newOwner common.Address) (*types.Transaction, error) { + return _OpenRegistrar.contract.Transact(opts, "setOwner", label, newOwner) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. +// +// Solidity: function setOwner(label bytes32, newOwner address) returns() +func (_OpenRegistrar *OpenRegistrarSession) SetOwner(label [32]byte, newOwner common.Address) (*types.Transaction, error) { + return _OpenRegistrar.Contract.SetOwner(&_OpenRegistrar.TransactOpts, label, newOwner) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x5b0fc9c3. +// +// Solidity: function setOwner(label bytes32, newOwner address) returns() +func (_OpenRegistrar *OpenRegistrarTransactorSession) SetOwner(label [32]byte, newOwner common.Address) (*types.Transaction, error) { + return _OpenRegistrar.Contract.SetOwner(&_OpenRegistrar.TransactOpts, label, newOwner) +} + +// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. +// +// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() +func (_OpenRegistrar *OpenRegistrarTransactor) SetResolver(opts *bind.TransactOpts, label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { + return _OpenRegistrar.contract.Transact(opts, "setResolver", label, resolver, nodeId) +} + +// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. +// +// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() +func (_OpenRegistrar *OpenRegistrarSession) SetResolver(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { + return _OpenRegistrar.Contract.SetResolver(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) +} + +// SetResolver is a paid mutator transaction binding the contract method 0xa9f2a1b2. +// +// Solidity: function setResolver(label bytes32, resolver address, nodeId bytes12) returns() +func (_OpenRegistrar *OpenRegistrarTransactorSession) SetResolver(label [32]byte, resolver common.Address, nodeId [12]byte) (*types.Transaction, error) { + return _OpenRegistrar.Contract.SetResolver(&_OpenRegistrar.TransactOpts, label, resolver, nodeId) +} diff --git a/swarm/services/ens/contract/PersonalResolver.abi b/swarm/services/ens/contract/PersonalResolver.abi new file mode 100644 index 0000000000..87cb9e525b --- /dev/null +++ b/swarm/services/ens/contract/PersonalResolver.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"}],"name":"deletePrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"isPersonalResolver","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setPrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"}],"name":"deleteRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"},{"inputs":[],"type":"constructor"}] diff --git a/swarm/services/ens/contract/PersonalResolver.bin b/swarm/services/ens/contract/PersonalResolver.bin new file mode 100644 index 0000000000..0c4c2a433f --- /dev/null +++ b/swarm/services/ens/contract/PersonalResolver.bin @@ -0,0 +1 @@ +606060405260008054600160a060020a031916331781558052600160208190527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4b556112798061004f6000396000f3606060405236156100825760e060020a600035046313af403581146100845780631b370194146100a65780633f5665e7146101085780638021061c1461011c5780638bba944d146101435780638da5cb5b146101b757806391c8e7b9146101c9578063a16fdafa14610237578063bc06183d1461026c578063edc0277c146102d3575b005b610082600435600054600160a060020a03908116339091161461042b57610002565b60408051602480356004818101356020818102808701820190975281865261008296833596939560449501929182919085019084908082843750949650505050505050600080548190600160a060020a03908116339091161461044057610002565b604080516001815290519081900360200190f35b6103166004356040805160208181018352600091829052825190810190925281525b919050565b60408051602060248035600481810135601f8101859004850286018501909652858552610082958135959194604494929390920191819084018382808284375094965050933593505060643591505060843560a435600080548190600160a060020a03908116339091161461054857610002565b610384600054600160a060020a031681565b6040805160248035600481810135602081810280870182019097528186526100829683359693956044950192918291908501908490808284375094965050933593505060643591505060843560a435600080548190600160a060020a0390811633909116146105dc57610002565b6103a1600435602435604435600060006000600060006000600060008861ffff1611156105ea575b5050939792965093509350565b60408051602060248035600481810135601f8101859004850286018501909652858552610082958135959194604494929390920191819084018382808284375094965050505050505060008054819033600160a060020a0390811691161461068f57610002565b6103e66004356024356000600060006000600061074f87875b60408051600160a060020a031984168152600c8101839052905190819003602c0190205b92915050565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156103765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b6040805161ffff96871681526001608060020a0319909516602086015263ffffffff939093168484015293166060830152608082019290925290519081900360a00190f35b6040805161ffff95909516855263ffffffff939093166020850152600160a060020a03199190911683830152600160a060020a03166060830152519081900360800190f35b60008054600160a060020a0319168217905550565b61047c8484600086515b6000808383016000190181805b868312610781576107a7898985815181101561000257906020019060200201516102ec565b600281015491935091506000141561049357610002565b600281015460019011156104af576104cf8160008080806104e3565b6104cf8484600086515b600060006108098686866001016001870361044a565b50505050565b90925090506105d281878787875b84546001608060020a031916608060020a948590041773ffffffff000000000000000000000000000000001916939092029290921775ffff0000000000000000000000000000000000000000191660a060020a90920291909117825560019190910155565b6104d58861057e895b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b604080518082018252600080825260208281018290528351808501855282815280820183905284518086019095526001855260f960020a601702918501919091529092839291908390819061094790610551565b5050505050505050565b6104d5888860008a5161044a565b600160a060020a03198a1660009081526001602052604081206002810154909350141561061a576003965061025f565b50807f2a0000000000000000000000000000000000000000000000000000000000000089148061065a57508054608060020a026001608060020a03191689145b1561025f5780546001820154608060020a8281029850820463ffffffff16965060a060020a90910461ffff169450925061025f565b61069c8461057e85610551565b60028101549193509150600014156106b357610002565b600281015460019011156106cf576104cf8160008080806104e3565b6104cf846106e985610551565b155b156105d2576105d288885b60406040519081016040528060008152602001600081526020015060006000600060006000610c5e610c956040604051908101604052806001815260200160f960020a6017028152602001506105519090565b610e1093503091505b5092959194509250565b600160a060020a03198116600090815260016020526040812060028101549295509250141561073c5760039450610745565b50505050600160a060020a03198516600090815260016020526040902094959350505050565b600160a060020a0319811660009081526001602052604081206002810154929450925014156107f75760016002828101829055600160a060020a03198b1660009081526040902001805490910190555b81985088506000199290920191610457565b915091506001600050600061082e8488600081518110156100025750602001516102ec565b600160a060020a031916815260208181019290925260400160009081208054600160b060020a0319168155600181018290556002810182905560038101805483825590835292822090926108b991908101905b8082111561093b576000818150805460018160011615610100020316600290046000825580601f1061090d57505b5050600101610881565b505050600281018054600019019081905560011480156108ea57508054608060020a026001608060020a0319166000145b80156108f65750600183115b1561093f5761093f868686600101600187036104b9565b601f0160209004906000526020600020908101906108af91905b8082111561093b5760008155600101610927565b5090565b505050505050565b93505b61097e875b805160001461013e565b50505050600160a060020a031984166000908152600160205260409020939492505050565b151561095957610a18878560408051808201909152600080825260208201526110f4838383604080518082019091526000808252602082810182905285518682015186519287015161111e939060008080808786116111d857602086116111e75760018660200360080260020a031980865116878a03890194505b808286511614611211576000198501948990116109f957889450611216565b9250610a238361094f565b15610a2d57610002565b610a4388610a9f855b8051602082015120919050565b600160a060020a031981166000908152600160205260408120600281015492945092501415610ad25760038101805460018101808355919082908015829011610adc57818360005260206000209182019101610adc9190610af1565b6102ec565b505060016002828101829055600160a060020a03198a16600090815260208390526040902001805490910190555b819750875061094a565b50505050610b4183610bb39090565b50506001015b8082111561093b576000818150805460018160011615610100020316600290046000825580601f10610b235750610aeb565b601f016020900490600052602060002090810190610aeb9190610927565b6003820180546000198101908110156100025790600052602060002090016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c2e57805160ff19168380011785555b50610aa4929150610927565b6040805160208181018352600080835283519182018452808252925184519293919290805910610be05750595b908082528060200260200182016040525091506020820190506110f4818560200151866000015160005b6020821061114757825184526020938401939290920191601f199190910190610c0a565b82800160010185558215610ba7579182015b82811115610ba7578251826000505591602001919060010190610c40565b9550610d308861057e896040805180820182526000808252602091820152815180830190925282518252828101519082015261013e565b889060408051808201909152600080825260208201526110f48383836040805180820190915260008082526020828101829052855186820151865192870151611165939060008080808088871161122d576020871161123f5760018760200360080260020a031980875116888b038a018a96505b818388511614610d25576001870196819010610d09578b8b0196505b505050839450611233565b600381015491965094509250600091505b82821015610dcf57610dd886610e7086600301600050858154811015610002579060005260206000209001600050604080518254602060026001831615610100026000190190921691909104601f810182900482028301820190935282825290929190830182828015610f1b5780601f10610ef057610100808354040283529160200191610f1b565b505050505b610ffa86610a36565b15610f265760038401805460001985019081101561000257906000526020600020900160005060038501805484908110156100025790600052602060002090016000509080546001816001161561010002031660029004828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f3257805485555b50610f6e929150610927565b9060006110fb838380518251600091829081908190819081908190819088901015610e9a57895197505b8a60200151965089602001519550600094505b878510156111ae578651865190945092508284146111c45750506020869003830160080260020a600019011980821681841603600081146111c4578098506111b6565b820191906000526020600020905b815481529060010190602001808311610efe57829003601f168201915b506105519350505050565b60019190910190610d41565b82800160010185558215610e6457600052602060002091601f016020900482015b82811115610e64578254825591600101919060010190610f53565b50506003840180546000198101808355919082908015829011610dca57818360005260206000209182019101610dca9190610faa565b50506001015b8082111561093b576000818150805460018160011615610100020316600290046000825580601f10610fdc5750610fa4565b601f016020900490600052602060002090810190610fa49190610927565b90506001600061100a87846102ec565b600160a060020a031916815260208181019290925260400160009081208054600160b060020a03191681556001810182905560028101829055600381018054838255908352928220909261109591908101905b8082111561093b576000818150805460018160011615610100020316600290046000825580601f106110d657505b505060010161105d565b505050600284018054600019019081905560011480156110c657508354608060020a026001608060020a0319166000145b80156106de57506106dc8761094f565b601f01602090049060005260206000209081019061108b9190610927565b5092915050565b6000149050610310565b8351835186519101900385525b8291505b509392505050565b602084810182905286018051875190830390038552519091508114156111055760008552611112565b50825191516020919091036101000a60001901918216911916179052565b602086810180519186019190915280518203855286519051919250018114156111915760008552611112565b835183518651910190038552835181016020860152829150611116565b89518b510398505b505050505050505092915050565b602096870196958601959490940193610ead565b8693505b505050949350505050565b8585208689038801935091505b8683106111d85750848220808214156112205785830193506111dc565b938701935b50508293506111dc565b60001992909201916111f4565b88880194505b50505050949350505050565b8686208894506000935091505b868903831161122d57508583208082141561126957839450611233565b600193840193929092019161124c56 \ No newline at end of file diff --git a/swarm/services/ens/contract/PersonalResolver.go b/swarm/services/ens/contract/PersonalResolver.go new file mode 100644 index 0000000000..c2ffd6d0e8 --- /dev/null +++ b/swarm/services/ens/contract/PersonalResolver.go @@ -0,0 +1,434 @@ +// This file is an automatically generated Go binding. Do not modify as any +// change will likely be lost upon the next re-generation! + +package contract + +import ( + "strings" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +// PersonalResolverABI is the input ABI used to generate the binding from. +const PersonalResolverABI = `[{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"}],"name":"deletePrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"isPersonalResolver","outputs":[{"name":"","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"bytes32"}],"name":"getExtended","outputs":[{"name":"data","type":"bytes"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setRR","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"bytes32[]"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"name":"setPrivateRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"qtype","type":"bytes32"},{"name":"index","type":"uint16"}],"name":"resolve","outputs":[{"name":"rcode","type":"uint16"},{"name":"rtype","type":"bytes16"},{"name":"ttl","type":"uint32"},{"name":"len","type":"uint16"},{"name":"data","type":"bytes32"}],"type":"function"},{"constant":false,"inputs":[{"name":"rootNodeId","type":"bytes12"},{"name":"name","type":"string"}],"name":"deleteRR","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"nodeId","type":"bytes12"},{"name":"label","type":"bytes32"}],"name":"findResolver","outputs":[{"name":"rcode","type":"uint16"},{"name":"ttl","type":"uint32"},{"name":"rnode","type":"bytes12"},{"name":"raddress","type":"address"}],"type":"function"},{"inputs":[],"type":"constructor"}]` + +// PersonalResolverBin is the compiled bytecode used for deploying new contracts. +const PersonalResolverBin = `60606040525b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550600160016000506000600074010000000000000000000000000000000000000000028152602001908152602001600020600050600201600050819055505b611cb58061007c6000396000f3606060405236156100a0576000357c01000000000000000000000000000000000000000000000000000000009004806313af4035146100a25780631b370194146100ba5780633f5665e7146101165780638021061c1461013b5780638bba944d146101bf5780638da5cb5b1461024257806391c8e7b91461027b578063a16fdafa146102fb578063bc06183d1461037a578063edc0277c146103d9576100a0565b005b6100b8600480803590602001909190505061045a565b005b610114600480803590602001909190803590602001908201803590602001919190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509090919050506104e5565b005b61012360048050506105c1565b60405180821515815260200191505060405180910390f35b61015160048080359060200190919050506105cf565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102406004808035906020019091908035906020019082018035906020019191908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050909091908035906020019091908035906020019091908035906020019091908035906020019091905050610603565b005b61024f6004805050610699565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f9600480803590602001909190803590602001908201803590602001919190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509090919080359060200190919080359060200190919080359060200190919080359060200190919050506106bf565b005b610323600480803590602001909190803590602001909190803590602001909190505061074f565b604051808661ffff168152602001856fffffffffffffffffffffffffffffffff191681526020018463ffffffff1681526020018361ffff168152602001826000191681526020019550505050505060405180910390f35b6103d76004808035906020019091908035906020019082018035906020019191908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509090919050506108b0565b005b6103f86004808035906020019091908035906020019091905050610998565b604051808561ffff1681526020018463ffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff191681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104b657610002565b80600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561054557610002565b610553848460008651610a14565b9150915060008160020160005054141561056c57610002565b6001816002016000505411156105ab576105a681600001600050600070010000000000000000000000000000000002600060006000610b41565b6105ba565b6105b9848460008651610bde565b5b5b50505050565b6000600190506105cc565b90565b6020604051908101604052806000815260200150602060405190810160405280600081526020015090506105fe565b919050565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561066357610002565b6106778861067289610dfd9090565b610e47565b9150915061068e8160000160005087878787610b41565b5b5050505050505050565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561071f57610002565b61072d888860008a51610a14565b915091506107448160000160005087878787610b41565b5b5050505050505050565b600060006000600060006000600060008861ffff16111561076f576108a3565b600160005060008b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060005091506000826002016000505414156107bc576003965086506108a3565b8160000160005090507f2a00000000000000000000000000000000000000000000000000000000000000600019168960001916148061083257508060000160009054906101000a9004700100000000000000000000000000000000026fffffffffffffffffffffffffffffffff19168960001916145b1561089e578060000160009054906101000a900470010000000000000000000000000000000002955085508060000160109054906101000a900463ffffffff16945084508060000160149054906101000a900461ffff16935083508060010160005054925082506108a3565b6108a3565b5050939792965093509350565b60006000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091057610002565b6109248461091f85610dfd9090565b610e47565b9150915060008160020160005054141561093d57610002565b60018160020160005054111561097c5761097781600001600050600070010000000000000000000000000000000002600060006000610b41565b610991565b6109908461098b85610dfd9090565b611197565b5b5b50505050565b600060006000600060006109ac87876116db565b92508250600160005060008473ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060005090506000816002016000505414156109fd57600394508450610a0a565b610e109350835030915081505b5092959194509250565b6000600060006000600060018688010392505b8683121515610af857610a4e898985815181101561000257906020019060200201516116db565b9150600160005060008373ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000509050600081600201600050541415610ae457600181600201600050819055506001600160005060008b73ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000506002016000828282505401925050819055505b81985088505b828060019003935050610a27565b88600160005060008b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060005080905094509450610b35565b50505094509492505050565b60208150602060ff161115610b5557610002565b838560000160006101000a8154816fffffffffffffffffffffffffffffffff021916908370010000000000000000000000000000000090040217905550828560000160106101000a81548163ffffffff02191690830217905550818560000160146101000a81548161ffff021916908302179055508085600101600050819055505b5050505050565b60006000610bf486866001870160018703610a14565b9150915060016000506000610c1e84886000815181101561000257906020019060200201516116db565b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006000820160006000820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a81549063ffffffff02191690556000820160146101000a81549061ffff02191690556001820160005060009055505060028201600050600090556003820160005080546000825590600052602060002090810190610d539190610cd6565b80821115610d4f576000818150805460018160011615610100020316600290046000825580601f10610d085750610d45565b601f016020900490600052602060002090810190610d449190610d26565b80821115610d405760008181506000905550600101610d26565b5090565b5b5050600101610cd6565b5090565b5b50505060018160020160008282825054039250508190555060018160020160005054148015610dd057506000700100000000000000000000000000000000028160000160005060000160009054906101000a9004700100000000000000000000000000000000026fffffffffffffffffffffffffffffffff1916145b8015610ddc5750600183115b15610df457610df386866001870160018703610bde565b5b5b505050505050565b604060405190810160405280600081526020016000815260200150600060208301905060406040519081016040528084518152602001828152602001509150610e41565b50919050565b6000600060406040519081016040528060008152602001600081526020015060406040519081016040528060008152602001600081526020015060006000610ec9604060405190810160405280600181526020017f2e00000000000000000000000000000000000000000000000000000000000000815260200150610dfd9090565b93505b610ed7876117219090565b151561114f57610eea8488611737909190565b9250610ef7836117219090565b15610f0157610002565b610f1588610f10856117659090565b6116db565b9150600160005060008373ffffffffffffffffffffffffffffffffffffffff19168152602001908152602001600020600050905060008160020160005054141561114557600181600301600050818180549050019150818154818355818115116110105781836000526020600020918201910161100f9190610f92565b8082111561100b576000818150805460018160011615610100020316600290046000825580601f10610fc45750611001565b601f0160209004906000526020600020908101906110009190610fe2565b80821115610ffc5760008181506000905550600101610fe2565b5090565b5b5050600101610f92565b5090565b5b5050505061101f836117779090565b816003016000506001836003016000508054905003815481101561000257906000526020600020900160005b509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061109557805160ff19168380011785556110c6565b828001600101855582156110c6579182015b828111156110c55782518260005055916020019190600101906110a7565b5b5090506110f191906110d3565b808211156110ed57600081815060009055506001016110d3565b5090565b5050600181600201600050819055506001600160005060008a73ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000506002016000828282505401925050819055505b8197508750610ecc565b87600160005060008a73ffffffffffffffffffffffffffffffffffffffff191681526020019081526020016000206000508090509550955061118c565b505050509250929050565b6040604051908101604052806000815260200160008152602001506000600060006000600061120c611203604060405190810160405280600181526020017f2e00000000000000000000000000000000000000000000000000000000000000815260200150610dfd9090565b886117ee909190565b95506112228861121d8961181c9090565b610e47565b9450945083600301600050805490509250600091505b828210156114dc5761130f866113078660030160005085815481101561000257906000526020600020900160005b508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112fb5780601f106112d0576101008083540402835291602001916112fb565b820191906000526020600020905b8154815290600101906020018083116112de57829003601f168201915b5050505050610dfd9090565b611864909190565b156114ce578360030160005060018403815481101561000257906000526020600020900160005b508460030160005083815481101561000257906000526020600020900160005b509080546001816001161561010002031660029004828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106113a457805485556113e1565b828001600101855582156113e157600052602060002091601f016020900482015b828111156113e05782548255916001019190600101906113c5565b5b50905061140c91906113ee565b8082111561140857600081815060009055506001016113ee565b5090565b5050600184600301600050818180549050039150818154818355818115116114c5578183600052602060002091820191016114c49190611447565b808211156114c0576000818150805460018160011615610100020316600290046000825580601f1061147957506114b6565b601f0160209004906000526020600020908101906114b59190611497565b808211156114b15760008181506000905550600101611497565b5090565b5b5050600101611447565b5090565b5b505050506114dc565b5b8180600101925050611238565b6114e7866117659090565b9050600160005060006114fa87846116db565b73ffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006000820160006000820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a81549063ffffffff02191690556000820160146101000a81549061ffff0219169055600182016000506000905550506002820160005060009055600382016000508054600082559060005260206000209081019061162f91906115b2565b8082111561162b576000818150805460018160011615610100020316600290046000825580601f106115e45750611621565b601f0160209004906000526020600020908101906116209190611602565b8082111561161c5760008181506000905550600101611602565b5090565b5b50506001016115b2565b5090565b5b505050600184600201600082828250540392505081905550600184600201600050541480156116ac57506000700100000000000000000000000000000000028460000160005060000160009054906101000a9004700100000000000000000000000000000000026fffffffffffffffffffffffffffffffff1916145b80156116c057506116be876117219090565b155b156116d0576116cf8888611197565b5b5b5050505050505050565b60008282604051808373ffffffffffffffffffffffffffffffffffffffff19168152600c0182600019168152602001925050506040518091039020905080505b92915050565b600060008260000151149050611732565b919050565b60406040519081016040528060008152602001600081526020015061175d838383611880565b505b92915050565b6000815160208301512090505b919050565b60206040519081016040528060008152602001506020604051908101604052806000815260200150600083600001516040518059106117b35750595b908082528060200260200182016040525091506020820190506117df8185602001518660000151611936565b8192506117e7565b5050919050565b604060405190810160405280600081526020016000815260200150611814838383611989565b505b92915050565b604060405190810160405280600081526020016000815260200150604060405190810160405280836000015181526020018360200151815260200150905061185f565b919050565b600060006118728484611a58565b14905061187a565b92915050565b60406040519081016040528060008152602001600081526020015060006118b98560000151866020015186600001518760200151611b23565b905080836020019090818152602001505084602001518103856000015103836000019090818152602001505084602001518114156119065760008560000190908181526020015050611926565b836000015183600001510185600001818151039150909081815260200150505b82915061192e565b509392505050565b60005b6020821015156119655782518452602084019350835060208301925082505b6020820391508150611939565b6001826020036101000a039050801983511681855116818117865250505b50505050565b60406040519081016040528060008152602001600081526020015060006119c28560000151866020015186600001518760200151611be7565b9050846020015183602001909081815260200150508460200151810383600001909081815260200150508460000151856020015101811415611a135760008560000190908181526020015050611a48565b836000015183600001510185600001818151039150909081815260200150508360000151810185602001909081815260200150505b829150611a50565b509392505050565b6000600060006000600060006000600060008a6000015197508a600001518a600001511015611a8b578960000151975087505b8a60200151965089602001519550600094505b87851015611b035786519350855192508284141515611ae557600185896020030160080260020a03199150818316828516039050600081141515611ae457809850611b15565b5b602087019650865060208601955085505b6020850194508450611a9e565b89600001518b60000151039850611b15565b505050505050505092915050565b60006000600060008786111515611bd457602086111515611b8e5760018660200360080260020a031980865116878a03890194505b808286511614611b7a57600185039450886001860111611b5857889450611b80565b87850194505b5050829350611bdc56611bd3565b85852091508588038701925082505b8683101515611bd2578583209050806000191682600019161415611bc5578583019350611bdc565b6001830392508250611b9d565b5b5b869350611bdc565b505050949350505050565b600060006000600060008887111515611c9f57602087111515611c4e5760018760200360080260020a031980875116888b038a018a96505b818388511614611c3f57600187019650806001880310611c1f578b8b0196505b505050839450611ca956611c9e565b868620915087935083506000925082505b86890383111515611c9d578684209050806000191682600019161415611c8757839450611ca9565b60018401935083505b8280600101935050611c5f565b5b5b8888019450611ca9565b5050505094935050505056` + +// DeployPersonalResolver deploys a new Ethereum contract, binding an instance of PersonalResolver to it. +func DeployPersonalResolver(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *PersonalResolver, error) { + parsed, err := abi.JSON(strings.NewReader(PersonalResolverABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PersonalResolverBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &PersonalResolver{PersonalResolverCaller: PersonalResolverCaller{contract: contract}, PersonalResolverTransactor: PersonalResolverTransactor{contract: contract}}, nil +} + +// PersonalResolver is an auto generated Go binding around an Ethereum contract. +type PersonalResolver struct { + PersonalResolverCaller // Read-only binding to the contract + PersonalResolverTransactor // Write-only binding to the contract +} + +// PersonalResolverCaller is an auto generated read-only Go binding around an Ethereum contract. +type PersonalResolverCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PersonalResolverTransactor is an auto generated write-only Go binding around an Ethereum contract. +type PersonalResolverTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PersonalResolverSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type PersonalResolverSession struct { + Contract *PersonalResolver // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PersonalResolverCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type PersonalResolverCallerSession struct { + Contract *PersonalResolverCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// PersonalResolverTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type PersonalResolverTransactorSession struct { + Contract *PersonalResolverTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PersonalResolverRaw is an auto generated low-level Go binding around an Ethereum contract. +type PersonalResolverRaw struct { + Contract *PersonalResolver // Generic contract binding to access the raw methods on +} + +// PersonalResolverCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type PersonalResolverCallerRaw struct { + Contract *PersonalResolverCaller // Generic read-only contract binding to access the raw methods on +} + +// PersonalResolverTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type PersonalResolverTransactorRaw struct { + Contract *PersonalResolverTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewPersonalResolver creates a new instance of PersonalResolver, bound to a specific deployed contract. +func NewPersonalResolver(address common.Address, backend bind.ContractBackend) (*PersonalResolver, error) { + contract, err := bindPersonalResolver(address, backend.(bind.ContractCaller), backend.(bind.ContractTransactor)) + if err != nil { + return nil, err + } + return &PersonalResolver{PersonalResolverCaller: PersonalResolverCaller{contract: contract}, PersonalResolverTransactor: PersonalResolverTransactor{contract: contract}}, nil +} + +// NewPersonalResolverCaller creates a new read-only instance of PersonalResolver, bound to a specific deployed contract. +func NewPersonalResolverCaller(address common.Address, caller bind.ContractCaller) (*PersonalResolverCaller, error) { + contract, err := bindPersonalResolver(address, caller, nil) + if err != nil { + return nil, err + } + return &PersonalResolverCaller{contract: contract}, nil +} + +// NewPersonalResolverTransactor creates a new write-only instance of PersonalResolver, bound to a specific deployed contract. +func NewPersonalResolverTransactor(address common.Address, transactor bind.ContractTransactor) (*PersonalResolverTransactor, error) { + contract, err := bindPersonalResolver(address, nil, transactor) + if err != nil { + return nil, err + } + return &PersonalResolverTransactor{contract: contract}, nil +} + +// bindPersonalResolver binds a generic wrapper to an already deployed contract. +func bindPersonalResolver(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(PersonalResolverABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_PersonalResolver *PersonalResolverRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _PersonalResolver.Contract.PersonalResolverCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_PersonalResolver *PersonalResolverRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PersonalResolver.Contract.PersonalResolverTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_PersonalResolver *PersonalResolverRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _PersonalResolver.Contract.PersonalResolverTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_PersonalResolver *PersonalResolverCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _PersonalResolver.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_PersonalResolver *PersonalResolverTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PersonalResolver.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_PersonalResolver *PersonalResolverTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _PersonalResolver.Contract.contract.Transact(opts, method, params...) +} + +// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// +// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) +func (_PersonalResolver *PersonalResolverCaller) FindResolver(opts *bind.CallOpts, nodeId [12]byte, label [32]byte) (struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address +}, error) { + ret := new(struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address + }) + out := ret + err := _PersonalResolver.contract.Call(opts, out, "findResolver", nodeId, label) + return *ret, err +} + +// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// +// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) +func (_PersonalResolver *PersonalResolverSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address +}, error) { + return _PersonalResolver.Contract.FindResolver(&_PersonalResolver.CallOpts, nodeId, label) +} + +// FindResolver is a free data retrieval call binding the contract method 0xedc0277c. +// +// Solidity: function findResolver(nodeId bytes12, label bytes32) constant returns(rcode uint16, ttl uint32, rnode bytes12, raddress address) +func (_PersonalResolver *PersonalResolverCallerSession) FindResolver(nodeId [12]byte, label [32]byte) (struct { + Rcode uint16 + Ttl uint32 + Rnode [12]byte + Raddress common.Address +}, error) { + return _PersonalResolver.Contract.FindResolver(&_PersonalResolver.CallOpts, nodeId, label) +} + +// GetExtended is a free data retrieval call binding the contract method 0x8021061c. +// +// Solidity: function getExtended(id bytes32) constant returns(data bytes) +func (_PersonalResolver *PersonalResolverCaller) GetExtended(opts *bind.CallOpts, id [32]byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _PersonalResolver.contract.Call(opts, out, "getExtended", id) + return *ret0, err +} + +// GetExtended is a free data retrieval call binding the contract method 0x8021061c. +// +// Solidity: function getExtended(id bytes32) constant returns(data bytes) +func (_PersonalResolver *PersonalResolverSession) GetExtended(id [32]byte) ([]byte, error) { + return _PersonalResolver.Contract.GetExtended(&_PersonalResolver.CallOpts, id) +} + +// GetExtended is a free data retrieval call binding the contract method 0x8021061c. +// +// Solidity: function getExtended(id bytes32) constant returns(data bytes) +func (_PersonalResolver *PersonalResolverCallerSession) GetExtended(id [32]byte) ([]byte, error) { + return _PersonalResolver.Contract.GetExtended(&_PersonalResolver.CallOpts, id) +} + +// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. +// +// Solidity: function isPersonalResolver() constant returns(bool) +func (_PersonalResolver *PersonalResolverCaller) IsPersonalResolver(opts *bind.CallOpts) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _PersonalResolver.contract.Call(opts, out, "isPersonalResolver") + return *ret0, err +} + +// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. +// +// Solidity: function isPersonalResolver() constant returns(bool) +func (_PersonalResolver *PersonalResolverSession) IsPersonalResolver() (bool, error) { + return _PersonalResolver.Contract.IsPersonalResolver(&_PersonalResolver.CallOpts) +} + +// IsPersonalResolver is a free data retrieval call binding the contract method 0x3f5665e7. +// +// Solidity: function isPersonalResolver() constant returns(bool) +func (_PersonalResolver *PersonalResolverCallerSession) IsPersonalResolver() (bool, error) { + return _PersonalResolver.Contract.IsPersonalResolver(&_PersonalResolver.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() constant returns(address) +func (_PersonalResolver *PersonalResolverCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var ( + ret0 = new(common.Address) + ) + out := ret0 + err := _PersonalResolver.contract.Call(opts, out, "owner") + return *ret0, err +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() constant returns(address) +func (_PersonalResolver *PersonalResolverSession) Owner() (common.Address, error) { + return _PersonalResolver.Contract.Owner(&_PersonalResolver.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() constant returns(address) +func (_PersonalResolver *PersonalResolverCallerSession) Owner() (common.Address, error) { + return _PersonalResolver.Contract.Owner(&_PersonalResolver.CallOpts) +} + +// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// +// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) +func (_PersonalResolver *PersonalResolverCaller) Resolve(opts *bind.CallOpts, nodeId [12]byte, qtype [32]byte, index uint16) (struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte +}, error) { + ret := new(struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte + }) + out := ret + err := _PersonalResolver.contract.Call(opts, out, "resolve", nodeId, qtype, index) + return *ret, err +} + +// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// +// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) +func (_PersonalResolver *PersonalResolverSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte +}, error) { + return _PersonalResolver.Contract.Resolve(&_PersonalResolver.CallOpts, nodeId, qtype, index) +} + +// Resolve is a free data retrieval call binding the contract method 0xa16fdafa. +// +// Solidity: function resolve(nodeId bytes12, qtype bytes32, index uint16) constant returns(rcode uint16, rtype bytes16, ttl uint32, len uint16, data bytes32) +func (_PersonalResolver *PersonalResolverCallerSession) Resolve(nodeId [12]byte, qtype [32]byte, index uint16) (struct { + Rcode uint16 + Rtype [16]byte + Ttl uint32 + Len uint16 + Data [32]byte +}, error) { + return _PersonalResolver.Contract.Resolve(&_PersonalResolver.CallOpts, nodeId, qtype, index) +} + +// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. +// +// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() +func (_PersonalResolver *PersonalResolverTransactor) DeletePrivateRR(opts *bind.TransactOpts, rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { + return _PersonalResolver.contract.Transact(opts, "deletePrivateRR", rootNodeId, name) +} + +// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. +// +// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() +func (_PersonalResolver *PersonalResolverSession) DeletePrivateRR(rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { + return _PersonalResolver.Contract.DeletePrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name) +} + +// DeletePrivateRR is a paid mutator transaction binding the contract method 0x1b370194. +// +// Solidity: function deletePrivateRR(rootNodeId bytes12, name bytes32[]) returns() +func (_PersonalResolver *PersonalResolverTransactorSession) DeletePrivateRR(rootNodeId [12]byte, name [][32]byte) (*types.Transaction, error) { + return _PersonalResolver.Contract.DeletePrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name) +} + +// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. +// +// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() +func (_PersonalResolver *PersonalResolverTransactor) DeleteRR(opts *bind.TransactOpts, rootNodeId [12]byte, name string) (*types.Transaction, error) { + return _PersonalResolver.contract.Transact(opts, "deleteRR", rootNodeId, name) +} + +// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. +// +// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() +func (_PersonalResolver *PersonalResolverSession) DeleteRR(rootNodeId [12]byte, name string) (*types.Transaction, error) { + return _PersonalResolver.Contract.DeleteRR(&_PersonalResolver.TransactOpts, rootNodeId, name) +} + +// DeleteRR is a paid mutator transaction binding the contract method 0xbc06183d. +// +// Solidity: function deleteRR(rootNodeId bytes12, name string) returns() +func (_PersonalResolver *PersonalResolverTransactorSession) DeleteRR(rootNodeId [12]byte, name string) (*types.Transaction, error) { + return _PersonalResolver.Contract.DeleteRR(&_PersonalResolver.TransactOpts, rootNodeId, name) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x13af4035. +// +// Solidity: function setOwner(newOwner address) returns() +func (_PersonalResolver *PersonalResolverTransactor) SetOwner(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _PersonalResolver.contract.Transact(opts, "setOwner", newOwner) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x13af4035. +// +// Solidity: function setOwner(newOwner address) returns() +func (_PersonalResolver *PersonalResolverSession) SetOwner(newOwner common.Address) (*types.Transaction, error) { + return _PersonalResolver.Contract.SetOwner(&_PersonalResolver.TransactOpts, newOwner) +} + +// SetOwner is a paid mutator transaction binding the contract method 0x13af4035. +// +// Solidity: function setOwner(newOwner address) returns() +func (_PersonalResolver *PersonalResolverTransactorSession) SetOwner(newOwner common.Address) (*types.Transaction, error) { + return _PersonalResolver.Contract.SetOwner(&_PersonalResolver.TransactOpts, newOwner) +} + +// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. +// +// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() +func (_PersonalResolver *PersonalResolverTransactor) SetPrivateRR(opts *bind.TransactOpts, rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { + return _PersonalResolver.contract.Transact(opts, "setPrivateRR", rootNodeId, name, rtype, ttl, len, data) +} + +// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. +// +// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() +func (_PersonalResolver *PersonalResolverSession) SetPrivateRR(rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { + return _PersonalResolver.Contract.SetPrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) +} + +// SetPrivateRR is a paid mutator transaction binding the contract method 0x91c8e7b9. +// +// Solidity: function setPrivateRR(rootNodeId bytes12, name bytes32[], rtype bytes16, ttl uint32, len uint16, data bytes32) returns() +func (_PersonalResolver *PersonalResolverTransactorSession) SetPrivateRR(rootNodeId [12]byte, name [][32]byte, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { + return _PersonalResolver.Contract.SetPrivateRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) +} + +// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. +// +// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() +func (_PersonalResolver *PersonalResolverTransactor) SetRR(opts *bind.TransactOpts, rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { + return _PersonalResolver.contract.Transact(opts, "setRR", rootNodeId, name, rtype, ttl, len, data) +} + +// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. +// +// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() +func (_PersonalResolver *PersonalResolverSession) SetRR(rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { + return _PersonalResolver.Contract.SetRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) +} + +// SetRR is a paid mutator transaction binding the contract method 0x8bba944d. +// +// Solidity: function setRR(rootNodeId bytes12, name string, rtype bytes16, ttl uint32, len uint16, data bytes32) returns() +func (_PersonalResolver *PersonalResolverTransactorSession) SetRR(rootNodeId [12]byte, name string, rtype [16]byte, ttl uint32, len uint16, data [32]byte) (*types.Transaction, error) { + return _PersonalResolver.Contract.SetRR(&_PersonalResolver.TransactOpts, rootNodeId, name, rtype, ttl, len, data) +} diff --git a/swarm/services/ens/ens.go b/swarm/services/ens/ens.go index 65022982c6..9cf9923d3a 100644 --- a/swarm/services/ens/ens.go +++ b/swarm/services/ens/ens.go @@ -3,7 +3,6 @@ package ens import ( "fmt" - "regexp" "strings" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -14,7 +13,6 @@ import ( "github.com/ethereum/go-ethereum/swarm/storage" ) -var domainAndVersion = regexp.MustCompile("[@:;,]+") var qtypeChash = [32]byte{ 0x43, 0x48, 0x41, 0x53, 0x48} var rtypeChash = [16]byte{ 0x43, 0x48, 0x41, 0x53, 0x48} @@ -46,13 +44,8 @@ func (self *ENS) newResolver(contractAddr common.Address) (*contract.ResolverSes } // resolve is a non-tranasctional call, returns hash as storage.Key -func (self *ENS) Resolve(hostPort string) (storage.Key, error) { - host := hostPort - parts := domainAndVersion.Split(host, 3) - if len(parts) > 1 && parts[1] != "" { - host = parts[0] - } - return self.resolveName(self.rootAddress, host) +func (self *ENS) Resolve(name string) (storage.Key, error) { + return self.resolveName(self.rootAddress, name) } func (self *ENS) nextResolver(resolver *contract.ResolverSession, nodeId [12]byte, label string) (*contract.ResolverSession, [12]byte, error) { diff --git a/swarm/services/ens/ens_test.go b/swarm/services/ens/ens_test.go index 7480d802d1..2082ae2d18 100644 --- a/swarm/services/ens/ens_test.go +++ b/swarm/services/ens/ens_test.go @@ -1,3 +1,5 @@ +//go:generate abigen --abi contract/OpenRegistrar.abi --bin contract/OpenRegistrar.bin --pkg contract --type OpenRegistrar --out contract/OpenRegistrar.go +//go:generate abigen --abi contract/PersonalResolver.abi --bin contract/PersonalResolver.bin --pkg contract --type PersonalResolver --out contract/PersonalResolver.go package ens import ( @@ -10,15 +12,9 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/swarm/services/ens/contract" ) -func init() { - glog.SetV(6) - glog.SetToStderr(true) -} - var ( key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") name = "my name on ENS" @@ -26,10 +22,21 @@ var ( addr = crypto.PubkeyToAddress(key.PublicKey) ) -func deploy(prvKey *ecdsa.PrivateKey, amount *big.Int, backend *backends.SimulatedBackend) (common.Address, error) { +func deployRegistrar(prvKey *ecdsa.PrivateKey, amount *big.Int, backend *backends.SimulatedBackend) (common.Address, error) { deployTransactor := bind.NewKeyedTransactor(prvKey) deployTransactor.Value = amount - addr, _, _, err := contract.DeployResolver(deployTransactor, backend) + addr, _, _, err := contract.DeployOpenRegistrar(deployTransactor, backend) + if err != nil { + return common.Address{}, err + } + backend.Commit() + return addr, nil +} + +func deployResolver(prvKey *ecdsa.PrivateKey, amount *big.Int, backend *backends.SimulatedBackend) (common.Address, error) { + deployTransactor := bind.NewKeyedTransactor(prvKey) + deployTransactor.Value = amount + addr, _, _, err := contract.DeployPersonalResolver(deployTransactor, backend) if err != nil { return common.Address{}, err } @@ -40,12 +47,12 @@ func deploy(prvKey *ecdsa.PrivateKey, amount *big.Int, backend *backends.Simulat func TestENS(t *testing.T) { contractBackend := backends.NewSimulatedBackend(core.GenesisAccount{addr, big.NewInt(1000000000)}) transactOpts := bind.NewKeyedTransactor(key) - contractAddr, err := deploy(key, big.NewInt(0), contractBackend) + contractAddr, err := deployRegistrar(key, big.NewInt(0), contractBackend) if err != nil { t.Fatalf("expected no error, got %v", err) } - resolverAddr, err := deploy(key, big.NewInt(0), contractBackend) + resolverAddr, err := deployResolver(key, big.NewInt(0), contractBackend) if err != nil { t.Fatalf("expected no error, got %v", err) } @@ -69,7 +76,6 @@ func TestENS(t *testing.T) { } if vhost.Hex() != hash.Hex()[2:] { t.Fatalf("resolve error, expected %v, got %v", hash.Hex(), vhost) - // t.Fatalf("resolve error, expected %v, got %v", transactOpts.From, hash) } }