[Pkg-privacy-commits] [Git][pkg-privacy-team/golang-goptlib][master] 3 commits: Update source in d/watch.

Danial Behzadi (@danialbehzadi) gitlab at salsa.debian.org
Wed Feb 21 23:18:33 GMT 2024



Danial Behzadi pushed to branch master at Privacy Maintainers / golang-goptlib


Commits:
d24bfb68 by Danial Behzadi at 2024-02-22T01:55:47+03:30
Update source in d/watch.

- - - - -
b3e990ce by Danial Behzadi at 2024-02-22T01:55:58+03:30
New upstream version 1.5.0
- - - - -
8356f242 by Danial Behzadi at 2024-02-22T02:46:30+03:30
Update upstream source from tag 'upstream/1.5.0'

Update to upstream version '1.5.0'
with Debian dir e1df1b2853bd12bcd42a10bdd3c94313088bf831

- - - - -


15 changed files:

- ChangeLog
- README
- debian/changelog
- + debian/clean
- − debian/compat
- debian/control
- debian/copyright
- debian/rules
- − debian/source/lintian-overrides
- + debian/upstream/metadata
- debian/watch
- examples/dummy-client/dummy-client.go
- examples/dummy-server/dummy-server.go
- go.mod
- pt.go


Changes:

=====================================
ChangeLog
=====================================
@@ -1,3 +1,20 @@
+== v1.5.0
+
+Added the ReportVersion function that lets a client or server report its
+implementation version using the new STATUS TYPE=version feature.
+
+https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/issues/1
+
+== v1.4.0
+
+Moved the repository URL from git.torproject.org/pluggable-transports/goptlib.git
+to gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib.
+
+== v1.3.0
+
+Added a DialOrWithDialer function that allows you to, for example, use a
+specific source address when dialing the ORPort.
+
 == v1.2.0
 
 The default and development branch is now "main" rather than "master".


=====================================
README
=====================================
@@ -1,12 +1,10 @@
 goptlib is a library for writing Tor pluggable transports in Go.
 
 https://spec.torproject.org/pt-spec
-https://gitweb.torproject.org/torspec.git/tree/proposals/196-transport-control-ports.txt
-https://gitweb.torproject.org/torspec.git/tree/proposals/217-ext-orport-auth.txt
-https://gitweb.torproject.org/torspec.git/tree/proposals/232-pluggable-transports-through-proxy.txt
+https://spec.torproject.org/ext-orport-spec
 
 To download a copy of the library into $GOPATH:
-	go get git.torproject.org/pluggable-transports/goptlib.git
+	go get gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib
 
 See the included example programs for examples of how to use the
 library. To build them, enter their directory and run "go build".
@@ -16,10 +14,10 @@ The recommended way to start writing a new transport plugin is to copy
 dummy-client or dummy-server and make changes to it.
 
 There is browseable documentation here:
-https://godoc.org/git.torproject.org/pluggable-transports/goptlib.git
+https://pkg.go.dev/gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib
 
 Report bugs to the tor-dev at lists.torproject.org mailing list or to the
-bug tracker at https://trac.torproject.org/projects/tor.
+bug tracker at https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/issues.
 
 To the extent possible under law, the authors have dedicated all
 copyright and related and neighboring rights to this software to the


=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+golang-goptlib (1.5.0-1) unstable; urgency=medium
+
+  * Update source in d/watch.
+  * Use '_build' as build root.
+  * New upstream version 1.5.0
+
+ -- Danial Behzadi <dani.behzi at ubuntu.com>  Thu, 22 Feb 2024 01:56:29 +0330
+
 golang-goptlib (1.2.0-1) unstable; urgency=medium
 
   [ Antoine Beaupré ]


=====================================
debian/clean
=====================================
@@ -0,0 +1 @@
+_build/


=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-13


=====================================
debian/control
=====================================
@@ -1,17 +1,26 @@
 Source: golang-goptlib
-Section: devel
+Section: golang
 Priority: optional
 Maintainer: Debian Privacy Tools Maintainers <pkg-privacy-maintainers at lists.alioth.debian.org>
-Uploaders: Ximin Luo <infinity0 at debian.org>
-Build-Depends: debhelper (>= 13.0.0), dh-golang, golang-go
-Standards-Version: 4.6.1
+Uploaders:
+ Ximin Luo <infinity0 at debian.org>,
+ Danial Behzadi <dani.behzi at ubuntu.com>,
+Build-Depends:
+ debhelper-compat (= 13),
+ dh-golang,
+ golang-go,
+Rules-Requires-Root: no
+Standards-Version: 4.6.2
+Homepage: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib
 Vcs-Git: https://salsa.debian.org/pkg-privacy-team/golang-goptlib.git
 Vcs-Browser: https://salsa.debian.org/pkg-privacy-team/golang-goptlib/
-XS-Go-Import-Path: git.torproject.org/pluggable-transports/goptlib.git
+XS-Go-Import-Path: gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib
 
 Package: golang-goptlib-dev
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
 Description: library for Tor pluggable transports written in Go
  goptlib is a little Go library which understands the Tor pluggable
  transport managed-proxy protocol. It is useful for developers writing


=====================================
debian/copyright
=====================================
@@ -7,7 +7,9 @@ Copyright: 2013-2014 David Fifield <david at bamsoftware.com>
 License: CC0-1.0
 
 Files: debian/*
-Copyright: 2014 Ximin Luo <infinity0 at debian.org>
+Copyright:
+ 2014 Ximin Luo <infinity0 at debian.org>,
+ 2024 Danial Behzadi <dani.behzi at ubuntu.com>
 License: CC0-1.0
 
 License: CC0-1.0


=====================================
debian/rules
=====================================
@@ -1,23 +1,17 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
-
-# Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-
-# default value from debhelper's Buildsystem.pm. perhaps there's a better way
-BUILDDIR = obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-
 %:
-	dh $@ --buildsystem=golang --with=golang
+	dh $@ --builddirectory=_build --buildsystem=golang --with=golang
 
 # we actually do compile the examples, for sanity.
 # but we don't want to install them as system binaries nor libraries
 # they are installed in the correct place by dh_installexamples
 override_dh_auto_install:
-	cd "$(BUILDDIR)" && rm -rf bin/ src/git.torproject.org/pluggable-transports/goptlib.git/examples
+	cd _build && rm -rf bin/ src/git.torproject.org/pluggable-transports/goptlib.git/examples
 	dh_auto_install
 
 override_dh_auto_test:
-	cp test_authcookie "$(BUILDDIR)"/src/git.torproject.org/pluggable-transports/goptlib.git
+	cp test_authcookie _build/src/gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib
 	dh_auto_test


=====================================
debian/source/lintian-overrides deleted
=====================================
@@ -1,2 +0,0 @@
-# these don't exist yet
-no-homepage-field


=====================================
debian/upstream/metadata
=====================================
@@ -0,0 +1,4 @@
+Bug-Database: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/issues/
+Bug-Submit: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/issues/new
+Repository: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib.git
+Repository-Browse: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib


=====================================
debian/watch
=====================================
@@ -1,4 +1,2 @@
-version=3
-opts=downloadurlmangle=s/tag\/\?h=([\w\.]+)/snapshot\/$1.tar.gz/,\
-filenamemangle=s/.*\?h=([\w\.]+)$/goptlib-$1.tar.gz/\
-  https://gitweb.torproject.org/pluggable-transports/goptlib.git/refs/tags  ^.*tag/\?h=([\w\.]+)
+version=4
+ https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/tags?sort=updated_desc archive/v at ANY_VERSION@/goptlib-v\d\S*@ARCHIVE_EXT@


=====================================
examples/dummy-client/dummy-client.go
=====================================
@@ -20,7 +20,7 @@ import (
 	"syscall"
 )
 
-import "git.torproject.org/pluggable-transports/goptlib.git"
+import "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib"
 
 var ptInfo pt.ClientInfo
 
@@ -80,6 +80,8 @@ func main() {
 		os.Exit(1)
 	}
 
+	pt.ReportVersion("dummy-client", "0.1")
+
 	if ptInfo.ProxyURL != nil {
 		pt.ProxyError("proxy is not supported")
 		os.Exit(1)


=====================================
examples/dummy-server/dummy-server.go
=====================================
@@ -21,7 +21,7 @@ import (
 	"syscall"
 )
 
-import "git.torproject.org/pluggable-transports/goptlib.git"
+import "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib"
 
 var ptInfo pt.ServerInfo
 
@@ -77,6 +77,8 @@ func main() {
 		os.Exit(1)
 	}
 
+	pt.ReportVersion("dummy-server", "0.1")
+
 	listeners := make([]net.Listener, 0)
 	for _, bindaddr := range ptInfo.Bindaddrs {
 		switch bindaddr.MethodName {


=====================================
go.mod
=====================================
@@ -1,3 +1,3 @@
-module git.torproject.org/pluggable-transports/goptlib.git
+module gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib
 
 go 1.11


=====================================
pt.go
=====================================
@@ -36,6 +36,7 @@
 // 	...
 // 	func main() {
 // 		var err error
+// 		pt.ReportVersion("program", "v1.0")
 // 		ptInfo, err = pt.ClientSetup(nil)
 // 		if err != nil {
 // 			os.Exit(1)
@@ -94,6 +95,7 @@
 // 	...
 // 	func main() {
 // 		var err error
+// 		pt.ReportVersion("program", "v1.0")
 // 		ptInfo, err = pt.ServerSetup(nil)
 // 		if err != nil {
 // 			os.Exit(1)
@@ -122,13 +124,7 @@
 // https://spec.torproject.org/pt-spec
 //
 // Extended ORPort:
-// https://gitweb.torproject.org/torspec.git/tree/proposals/196-transport-control-ports.txt
-//
-// Extended ORPort Authentication:
-// https://gitweb.torproject.org/torspec.git/tree/proposals/217-ext-orport-auth.txt
-//
-// Pluggable Transport through SOCKS proxy:
-// https://gitweb.torproject.org/torspec.git/tree/proposals/232-pluggable-transports-through-proxy.txt
+// https://spec.torproject.org/ext-orport-spec
 //
 // The package implements a SOCKS5 server sufficient for a Tor client transport
 // plugin.
@@ -349,6 +345,15 @@ func ProxyDone() {
 	fmt.Fprintf(Stdout, "PROXY DONE\n")
 }
 
+// Report this program's name and version number using a STATUS TYPE=version
+// line. Can be called any time before calling CmethodsDone or SmethodsDone.
+//
+// When called in a pluggable transport server, the implementation name and
+// version number will appear in the relay's bridge-extra-info descriptor.
+func ReportVersion(implementation string, version string) {
+	line("STATUS", "TYPE=version", "IMPLEMENTATION="+encodeCString(implementation), "VERSION="+encodeCString(version))
+}
+
 // Unexported type to represent log severities, preventing external callers from
 // inventing new severity strings that may violate quoting rules.
 //
@@ -680,7 +685,7 @@ func readAuthCookie(f io.Reader) ([]byte, error) {
 }
 
 // Read and validate the contents of an auth cookie file. Returns the 32-byte
-// cookie. See section 4.2.1.2 of 217-ext-orport-auth.txt.
+// cookie. See section 2.1.2 of ext-orport-spec.txt.
 func readAuthCookieFile(filename string) (cookie []byte, err error) {
 	f, err := os.Open(filename)
 	if err != nil {
@@ -770,7 +775,7 @@ func ServerSetup(_ []string) (info ServerInfo, err error) {
 	return info, nil
 }
 
-// See 217-ext-orport-auth.txt section 4.2.1.3.
+// See ext-orport-spec.txt section 2.1.3.
 func computeServerHash(authCookie, clientNonce, serverNonce []byte) []byte {
 	h := hmac.New(sha256.New, authCookie)
 	io.WriteString(h, "ExtORPort authentication server-to-client hash")
@@ -779,7 +784,7 @@ func computeServerHash(authCookie, clientNonce, serverNonce []byte) []byte {
 	return h.Sum([]byte{})
 }
 
-// See 217-ext-orport-auth.txt section 4.2.1.3.
+// See ext-orport-spec.txt section 2.1.3.
 func computeClientHash(authCookie, clientNonce, serverNonce []byte) []byte {
 	h := hmac.New(sha256.New, authCookie)
 	io.WriteString(h, "ExtORPort authentication client-to-server hash")
@@ -789,7 +794,7 @@ func computeClientHash(authCookie, clientNonce, serverNonce []byte) []byte {
 }
 
 func extOrPortAuthenticate(s io.ReadWriter, info *ServerInfo) error {
-	// Read auth types. 217-ext-orport-auth.txt section 4.1.
+	// Read auth types. ext-orport-spec.txt section 2.
 	var authTypes [256]bool
 	var count int
 	for count = 0; count < 256; count++ {
@@ -872,7 +877,7 @@ func extOrPortAuthenticate(s io.ReadWriter, info *ServerInfo) error {
 	return nil
 }
 
-// See section 3.1.1 of 196-transport-control-ports.txt.
+// See section 3.1 of ext-orport-spec.txt.
 const (
 	extOrCmdDone      = 0x0000
 	extOrCmdUserAddr  = 0x0001
@@ -906,19 +911,17 @@ func extOrPortSendCommand(s io.Writer, cmd uint16, body []byte) error {
 	return nil
 }
 
-// Send a USERADDR command on s. See section 3.1.2.1 of
-// 196-transport-control-ports.txt.
+// Send a USERADDR command on s. See section 3.2.1 of ext-orport-spec.txt.
 func extOrPortSendUserAddr(s io.Writer, addr string) error {
 	return extOrPortSendCommand(s, extOrCmdUserAddr, []byte(addr))
 }
 
-// Send a TRANSPORT command on s. See section 3.1.2.2 of
-// 196-transport-control-ports.txt.
+// Send a TRANSPORT command on s. See section 3.2.2 of ext-orport-spec.txt.
 func extOrPortSendTransport(s io.Writer, methodName string) error {
 	return extOrPortSendCommand(s, extOrCmdTransport, []byte(methodName))
 }
 
-// Send a DONE command on s. See section 3.1 of 196-transport-control-ports.txt.
+// Send a DONE command on s. See section 3.1 of ext-orport-spec.txt.
 func extOrPortSendDone(s io.Writer) error {
 	return extOrPortSendCommand(s, extOrCmdDone, []byte{})
 }
@@ -987,7 +990,7 @@ func extOrPortSetMetadata(s io.ReadWriter, addr, methodName string) error {
 
 func extOrPortSetup(s net.Conn, timeout time.Duration,
 	info *ServerInfo, addr, methodName string) error {
-	err := s.SetDeadline(time.Now().Add(5 * time.Second))
+	err := s.SetDeadline(time.Now().Add(timeout))
 	if err != nil {
 		return err
 	}
@@ -1006,20 +1009,20 @@ func extOrPortSetup(s net.Conn, timeout time.Duration,
 	return nil
 }
 
-// Dial info.ExtendedOrAddr if defined, or else info.OrAddr, and return an open
-// *net.TCPConn. If connecting to the extended OR port, extended OR port
-// authentication à la 217-ext-orport-auth.txt is done before returning; an
-// error is returned if authentication fails.
+// Dial (using the given net.Dialer) info.ExtendedOrAddr if defined, or else
+// info.OrAddr, and return an open net.Conn. If connecting to the extended OR
+// port, extended OR port authentication is done before returning; an error is
+// returned if authentication fails.
 //
 // The addr and methodName arguments are put in USERADDR and TRANSPORT ExtOrPort
 // commands, respectively. If either is "", the corresponding command is not
 // sent.
-func DialOr(info *ServerInfo, addr, methodName string) (*net.TCPConn, error) {
+func DialOrWithDialer(dialer *net.Dialer, info *ServerInfo, addr, methodName string) (net.Conn, error) {
 	if info.ExtendedOrAddr == nil || info.AuthCookiePath == "" {
-		return net.DialTCP("tcp", nil, info.OrAddr)
+		return dialer.Dial("tcp", info.OrAddr.String())
 	}
 
-	s, err := net.DialTCP("tcp", nil, info.ExtendedOrAddr)
+	s, err := dialer.Dial("tcp", info.ExtendedOrAddr.String())
 	if err != nil {
 		return nil, err
 	}
@@ -1031,3 +1034,16 @@ func DialOr(info *ServerInfo, addr, methodName string) (*net.TCPConn, error) {
 
 	return s, nil
 }
+
+// Dial info.ExtendedOrAddr if defined, or else info.OrAddr, and return an open
+// *net.TCPConn. If connecting to the extended OR port, extended OR port
+// authentication is done before returning; an error is returned if
+// authentication fails.
+//
+// The addr and methodName arguments are put in USERADDR and TRANSPORT ExtOrPort
+// commands, respectively. If either is "", the corresponding command is not
+// sent.
+func DialOr(info *ServerInfo, addr, methodName string) (*net.TCPConn, error) {
+	c, err := DialOrWithDialer(&net.Dialer{}, info, addr, methodName)
+	return c.(*net.TCPConn), err
+}



View it on GitLab: https://salsa.debian.org/pkg-privacy-team/golang-goptlib/-/compare/1a409203ccf289948fe3d04a7eb1845fb8eba125...8356f242918d829365276306091a7737ee7082d1

-- 
View it on GitLab: https://salsa.debian.org/pkg-privacy-team/golang-goptlib/-/compare/1a409203ccf289948fe3d04a7eb1845fb8eba125...8356f242918d829365276306091a7737ee7082d1
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-privacy-commits/attachments/20240221/c8b2b175/attachment-0001.htm>


More information about the Pkg-privacy-commits mailing list