Skip to content

Commit

Permalink
pretend to be a tor version
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcloughlin committed Nov 5, 2017
1 parent 3705e1c commit 7dee73d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cmd/pearl/cmd/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"net"

"github.com/mmcloughlin/pearl/meta"
"github.com/mmcloughlin/pearl/torconfig"
"github.com/mmcloughlin/pearl/tordir"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -58,7 +57,7 @@ func (c *Config) Config() (*torconfig.Config, error) {
Nickname: c.nickname,
IP: c.ip,
ORPort: uint16(c.port),
Platform: meta.Platform.String(),
Platform: torconfig.NewOfficialPlatform("0.2.9.11").String(),
Contact: c.contact,
BandwidthAverage: c.bwAvg,
BandwidthBurst: c.bwBurst,
Expand Down
4 changes: 2 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/mmcloughlin/pearl/log"
"github.com/mmcloughlin/pearl/meta"
"github.com/mmcloughlin/pearl/protover"
"github.com/mmcloughlin/pearl/torconfig"
"github.com/mmcloughlin/pearl/torcrypto"
"github.com/mmcloughlin/pearl/tordir"
Expand Down Expand Up @@ -160,7 +160,7 @@ func (r *Router) Descriptor() (*tordir.ServerDescriptor, error) {
s.SetPublishedTime(time.Now())
s.SetUptime(time.Since(r.startTime))
s.SetExitPolicy(torexitpolicy.RejectAllPolicy)
s.SetProtocols(meta.Protocols)
s.SetProtocols(protover.RelayRequired)

return s, nil
}
6 changes: 6 additions & 0 deletions torconfig/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func NewPlatformHostOS(software, version string) Platform {
return NewPlatform(software, version, runtime.GOOS)
}

// NewOfficialPlatform constructs a new Platform object for official Tor of the
// given version.
func NewOfficialPlatform(version string) Platform {
return NewPlatformHostOS("Tor", version)
}

// String converts Platform to the standard string representation seen in
// server descriptors.
func (p Platform) String() string {
Expand Down

0 comments on commit 7dee73d

Please sign in to comment.