X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=cmd%2Fproxy%2Fmain.go;h=929c5b668b1759f6d08b275b4ed850e451bfc39a;hb=HEAD;hp=3fd4f7752329d297cc817114905ae8310a79a727;hpb=ea05d18d829be5b6c617d6e71144349b2abb856d;p=ucspi.git diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index 3fd4f77..929c5b6 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -1,19 +1,17 @@ -/* -ucspi/cmd/tlsc -- UCSPI TLS client -Copyright (C) 2021 Sergey Matveev - -This program 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, version 3 of the License. - -This program 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 this program. If not, see . -*/ +// ucspi/cmd/proxy -- UCSPI TCP proxy +// Copyright (C) 2021-2024 Sergey Matveev +// +// This program 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, version 3 of the License. +// +// This program 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 this program. If not, see . package main @@ -33,24 +31,24 @@ func main() { log.SetFlags(log.Lshortfile) r := os.NewFile(6, "R") - w := os.NewFile(7, "W") if r == nil { log.Fatalln("no 6 file descriptor") } + w := os.NewFile(7, "W") if w == nil { log.Fatalln("no 7 file descriptor") } - copiers := make(chan struct{}) + worker := make(chan struct{}) var err error go func() { _, err = io.Copy(w, os.Stdin) w.Close() - close(copiers) + close(worker) }() go func() { io.Copy(os.Stdout, r) }() - <-copiers + <-worker if err != nil { log.Fatalln(err) }