From 98bc6bcaf776989511a6ce3c845c2e8ad2419e22 Mon Sep 17 00:00:00 2001 From: Brian Conway Date: Mon, 4 Dec 2023 13:15:23 -0600 Subject: [PATCH] Update app, event, and identity DAO for RW and RO database connections - Update DAO, integration tests, and hermes-api and hermes-notifier services. - Sync `vendor/` for updated dependencies. - All test variations pass. --- build/deploy/hermes/docker-compose.yml | 10 +++--- go.mod | 14 ++++---- go.sum | 28 ++++++++-------- internal/hermes-api/api/api.go | 23 ++++++++----- internal/hermes-api/config/config.go | 7 ++-- internal/hermes-api/test/main_test.go | 9 +++--- internal/hermes-notifier/config/config.go | 7 ++-- internal/hermes-notifier/notifier/notifier.go | 13 +++++--- internal/hermes-notifier/test/main_test.go | 11 ++++--- pkg/dao/app/crudl.go | 26 ++++++++------- pkg/dao/app/dao.go | 8 +++-- pkg/dao/app/main_test.go | 2 +- pkg/dao/event/crudl.go | 10 +++--- pkg/dao/event/dao.go | 8 +++-- pkg/dao/event/main_test.go | 2 +- pkg/dao/identity/crudl.go | 21 ++++++------ pkg/dao/identity/dao.go | 8 +++-- pkg/dao/identity/main_test.go | 4 +-- tool/hermes-create/main.go | 4 +-- .../jackc/pgservicefile/.travis.yml | 9 ------ .../github.com/jackc/pgservicefile/README.md | 5 +-- vendor/golang.org/x/sys/unix/fcntl.go | 2 +- vendor/golang.org/x/sys/unix/ioctl_linux.go | 5 +++ vendor/golang.org/x/sys/unix/mkerrors.sh | 3 +- vendor/golang.org/x/sys/unix/syscall_bsd.go | 2 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 28 ++++++++++------ .../golang.org/x/sys/unix/syscall_openbsd.go | 14 ++++++++ .../golang.org/x/sys/unix/syscall_solaris.go | 2 +- .../x/sys/unix/syscall_zos_s390x.go | 2 +- vendor/golang.org/x/sys/unix/zerrors_linux.go | 2 +- .../golang.org/x/sys/unix/zsyscall_linux.go | 15 +++++++++ .../x/sys/unix/zsyscall_openbsd_386.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_386.s | 5 +++ .../x/sys/unix/zsyscall_openbsd_amd64.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_amd64.s | 5 +++ .../x/sys/unix/zsyscall_openbsd_arm.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_arm.s | 5 +++ .../x/sys/unix/zsyscall_openbsd_arm64.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_arm64.s | 5 +++ .../x/sys/unix/zsyscall_openbsd_mips64.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_mips64.s | 5 +++ .../x/sys/unix/zsyscall_openbsd_ppc64.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_ppc64.s | 6 ++++ .../x/sys/unix/zsyscall_openbsd_riscv64.go | 26 +++++++++++++++ .../x/sys/unix/zsyscall_openbsd_riscv64.s | 5 +++ vendor/golang.org/x/sys/unix/ztypes_linux.go | 32 +++++++++++++++++++ vendor/modules.txt | 14 ++++---- 47 files changed, 442 insertions(+), 126 deletions(-) delete mode 100644 vendor/github.com/jackc/pgservicefile/.travis.yml diff --git a/build/deploy/hermes/docker-compose.yml b/build/deploy/hermes/docker-compose.yml index b3dfc12a..c3d29edc 100644 --- a/build/deploy/hermes/docker-compose.yml +++ b/build/deploy/hermes/docker-compose.yml @@ -1,14 +1,15 @@ version: "3" services: hermes-api: - image: ghcr.io/ownmfa/hermes:4d717212 + image: ghcr.io/ownmfa/hermes:9eaa9ee8 command: hermes-api restart: on-failure depends_on: - hermes-notifier environment: - API_STATSD_ADDR=dogstatsd:8125 - - API_PG_URI=postgres://postgres:notasecurepassword@postgres/hermes + - API_PG_RW_URI=postgres://postgres:notasecurepassword@postgres/hermes + - API_PG_RO_URI=postgres://postgres:notasecurepassword@postgres/hermes - API_REDIS_HOST=redis - API_PWT_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= - API_IDENTITY_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= @@ -35,12 +36,13 @@ services: - "traefik.http.services.hermes-grpc.loadbalancer.server.scheme=h2c" hermes-notifier: - image: ghcr.io/ownmfa/hermes:4d717212 + image: ghcr.io/ownmfa/hermes:9eaa9ee8 command: hermes-notifier restart: on-failure environment: - NOTIFIER_STATSD_ADDR=dogstatsd:8125 - - NOTIFIER_PG_URI=postgres://postgres:notasecurepassword@postgres/hermes + - NOTIFIER_PG_RW_URI=postgres://postgres:notasecurepassword@postgres/hermes + - NOTIFIER_PG_RO_URI=postgres://postgres:notasecurepassword@postgres/hermes - NOTIFIER_REDIS_HOST=redis - NOTIFIER_IDENTITY_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= - NOTIFIER_NSQ_PUB_ADDR=nsqd:4150 diff --git a/go.mod b/go.mod index e087236c..e1c9d64b 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/smira/go-statsd v1.3.3 github.com/stretchr/testify v1.8.4 go.uber.org/mock v0.3.0 - golang.org/x/crypto v0.15.0 + golang.org/x/crypto v0.16.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 ) @@ -30,16 +30,16 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - golang.org/x/net v0.18.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index c4c9f907..c12fa92b 100644 --- a/go.sum +++ b/go.sum @@ -530,8 +530,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA= +github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgx/v5 v5.5.0 h1:NxstgwndsTRy7eq9/kqYc/BZh5w2hHJV86wjvO+1xPw= github.com/jackc/pgx/v5 v5.5.0/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= @@ -606,8 +606,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -691,8 +691,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -797,8 +797,8 @@ golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1045,12 +1045,12 @@ google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZV google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/genproto v0.0.0-20230202175211-008b39050e57/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= +google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 h1:W12Pwm4urIbRdGhMEg2NM9O3TWKjNcxQhs46V0ypf/k= +google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic= +google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 h1:ZcOkrmX74HbKFYnpPY8Qsw93fC29TbJXspYKaBkSXDQ= +google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4/go.mod h1:k2dtGpRrbsSyKcNPKKI5sstZkrNCZwpU/ns96JoHbGg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/hermes-api/api/api.go b/internal/hermes-api/api/api.go index aee5dc05..a359388f 100644 --- a/internal/hermes-api/api/api.go +++ b/internal/hermes-api/api/api.go @@ -71,7 +71,12 @@ func New(cfg *config.Config) (*API, error) { } // Set up database connection. - pg, err := dao.NewPgDB(cfg.PgURI) + pgRW, err := dao.NewPgDB(cfg.PgRwURI) + if err != nil { + return nil, err + } + + pgRO, err := dao.NewPgDB(cfg.PgRoURI) if err != nil { return nil, err } @@ -109,7 +114,7 @@ func New(cfg *config.Config) (*API, error) { "/ownmfa.api.UserService/UpdateUser": {}, } - orgDAO := org.NewDAO(pg, redis, orgExp) + orgDAO := org.NewDAO(pgRW, redis, orgExp) srv := grpc.NewServer(grpc.ChainUnaryInterceptor( interceptor.Log(nil), interceptor.Auth(skipAuth, cfg.PWTKey, redis, orgDAO), @@ -117,13 +122,15 @@ func New(cfg *config.Config) (*API, error) { )) api.RegisterAppIdentityServiceServer(srv, - service.NewAppIdentity(app.NewDAO(pg), identity.NewDAO(pg, - cfg.IdentityKey), event.NewDAO(pg), redis, n, nsq, cfg.NSQPubTopic)) - api.RegisterEventServiceServer(srv, service.NewEvent(event.NewDAO(pg))) + service.NewAppIdentity(app.NewDAO(pgRW, pgRO), identity.NewDAO(pgRW, + pgRO, cfg.IdentityKey), event.NewDAO(pgRW, pgRO), redis, n, nsq, + cfg.NSQPubTopic)) + api.RegisterEventServiceServer(srv, service.NewEvent(event.NewDAO(pgRW, + pgRO))) api.RegisterOrgServiceServer(srv, service.NewOrg(orgDAO)) - api.RegisterSessionServiceServer(srv, service.NewSession(user.NewDAO(pg), - key.NewDAO(pg), redis, cfg.PWTKey)) - api.RegisterUserServiceServer(srv, service.NewUser(user.NewDAO(pg))) + api.RegisterSessionServiceServer(srv, service.NewSession(user.NewDAO(pgRW), + key.NewDAO(pgRW), redis, cfg.PWTKey)) + api.RegisterUserServiceServer(srv, service.NewUser(user.NewDAO(pgRW))) // Register gRPC-Gateway handlers. ctx, cancel := context.WithCancel(context.Background()) diff --git a/internal/hermes-api/config/config.go b/internal/hermes-api/config/config.go index 6e6f29a4..3ba23c2d 100644 --- a/internal/hermes-api/config/config.go +++ b/internal/hermes-api/config/config.go @@ -11,7 +11,8 @@ type Config struct { LogLevel string StatsDAddr string - PgURI string + PgRwURI string + PgRoURI string RedisHost string NSQPubAddr string @@ -32,7 +33,9 @@ func New() *Config { LogLevel: config.String(pref+"LOG_LEVEL", "DEBUG"), StatsDAddr: config.String(pref+"STATSD_ADDR", ""), - PgURI: config.String(pref+"PG_URI", + PgRwURI: config.String(pref+"PG_RW_URI", + "postgres://postgres:postgres@127.0.0.1/hermes_test"), + PgRoURI: config.String(pref+"PG_RO_URI", "postgres://postgres:postgres@127.0.0.1/hermes_test"), RedisHost: config.String(pref+"REDIS_HOST", "127.0.0.1"), diff --git a/internal/hermes-api/test/main_test.go b/internal/hermes-api/test/main_test.go index 0210346d..64e1ad94 100644 --- a/internal/hermes-api/test/main_test.go +++ b/internal/hermes-api/test/main_test.go @@ -65,7 +65,8 @@ func TestMain(m *testing.M) { // Set up Config. testConfig := testconfig.New() cfg := config.New() - cfg.PgURI = testConfig.PgURI + cfg.PgRwURI = testConfig.PgURI + cfg.PgRoURI = testConfig.PgURI cfg.RedisHost = testConfig.RedisHost cfg.NSQPubAddr = testConfig.NSQPubAddr @@ -89,14 +90,14 @@ func TestMain(m *testing.M) { }() // Set up database connection. - pg, err := dao.NewPgDB(cfg.PgURI) + pg, err := dao.NewPgDB(cfg.PgRwURI) if err != nil { log.Fatalf("TestMain dao.NewPgDB: %v", err) } globalOrgDAO = org.NewDAO(pg, nil, 0) globalUserDAO = user.NewDAO(pg) - globalIdentDAO = identity.NewDAO(pg, key) - globalEvDAO = event.NewDAO(pg) + globalIdentDAO = identity.NewDAO(pg, pg, key) + globalEvDAO = event.NewDAO(pg, pg) // Set up cache connection. globalCache, err = cache.NewRedis(cfg.RedisHost + ":6379") diff --git a/internal/hermes-notifier/config/config.go b/internal/hermes-notifier/config/config.go index f8b4de28..fd8c552b 100644 --- a/internal/hermes-notifier/config/config.go +++ b/internal/hermes-notifier/config/config.go @@ -12,7 +12,8 @@ type Config struct { StatsDAddr string Concurrency int - PgURI string + PgRwURI string + PgRoURI string RedisHost string IdentityKey []byte @@ -38,7 +39,9 @@ func New() *Config { StatsDAddr: config.String(pref+"STATSD_ADDR", ""), Concurrency: config.Int(pref+"CONCURRENCY", 5), - PgURI: config.String(pref+"PG_URI", + PgRwURI: config.String(pref+"PG_RW_URI", + "postgres://postgres:postgres@127.0.0.1/hermes_test"), + PgRoURI: config.String(pref+"PG_RO_URI", "postgres://postgres:postgres@127.0.0.1/hermes_test"), RedisHost: config.String(pref+"REDIS_HOST", "127.0.0.1"), diff --git a/internal/hermes-notifier/notifier/notifier.go b/internal/hermes-notifier/notifier/notifier.go index c05b2737..af3958b5 100644 --- a/internal/hermes-notifier/notifier/notifier.go +++ b/internal/hermes-notifier/notifier/notifier.go @@ -66,7 +66,12 @@ func New(cfg *config.Config) (*Notifier, error) { } // Set up database connection. - pg, err := dao.NewPgDB(cfg.PgURI) + pgRW, err := dao.NewPgDB(cfg.PgRwURI) + if err != nil { + return nil, err + } + + pgRO, err := dao.NewPgDB(cfg.PgRoURI) if err != nil { return nil, err } @@ -107,9 +112,9 @@ func New(cfg *config.Config) (*Notifier, error) { } return &Notifier{ - appDAO: app.NewDAO(pg), - identDAO: identity.NewDAO(pg, cfg.IdentityKey), - evDAO: event.NewDAO(pg), + appDAO: app.NewDAO(pgRW, pgRO), + identDAO: identity.NewDAO(pgRW, pgRO, cfg.IdentityKey), + evDAO: event.NewDAO(pgRW, pgRO), cache: redis, notQueue: nsq, diff --git a/internal/hermes-notifier/test/main_test.go b/internal/hermes-notifier/test/main_test.go index 87c5bd62..93575c48 100644 --- a/internal/hermes-notifier/test/main_test.go +++ b/internal/hermes-notifier/test/main_test.go @@ -41,7 +41,8 @@ func TestMain(m *testing.M) { // Set up Config. testConfig := testconfig.New() cfg := config.New() - cfg.PgURI = testConfig.PgURI + cfg.PgRwURI = testConfig.PgURI + cfg.PgRoURI = testConfig.PgURI cfg.RedisHost = testConfig.RedisHost cfg.IdentityKey = key @@ -74,14 +75,14 @@ func TestMain(m *testing.M) { }() // Set up database connection. - pg, err := dao.NewPgDB(cfg.PgURI) + pg, err := dao.NewPgDB(cfg.PgRwURI) if err != nil { log.Fatalf("TestMain dao.NewPgDB: %v", err) } globalOrgDAO = org.NewDAO(pg, nil, 0) - globalAppDAO = app.NewDAO(pg) - globalIdentDAO = identity.NewDAO(pg, key) - globalEvDAO = event.NewDAO(pg) + globalAppDAO = app.NewDAO(pg, pg) + globalIdentDAO = identity.NewDAO(pg, pg, key) + globalEvDAO = event.NewDAO(pg, pg) // Set up cache connection. globalCache, err = cache.NewRedis(cfg.RedisHost + ":6379") diff --git a/pkg/dao/app/crudl.go b/pkg/dao/app/crudl.go index a5943ec6..ee2a8c11 100644 --- a/pkg/dao/app/crudl.go +++ b/pkg/dao/app/crudl.go @@ -25,10 +25,11 @@ func (d *DAO) Create(ctx context.Context, app *api.App) (*api.App, error) { app.CreatedAt = timestamppb.New(now) app.UpdatedAt = timestamppb.New(now) - if err := d.pg.QueryRowContext(ctx, createApp, app.GetOrgId(), app.GetName(), - app.GetDisplayName(), app.GetEmail(), app.GetPushoverKey(), app.GetSubjectTemplate(), - app.GetTextBodyTemplate(), app.GetHtmlBodyTemplate(), now).Scan( - &app.Id); err != nil { + if err := d.rw.QueryRowContext(ctx, createApp, app.GetOrgId(), + app.GetName(), app.GetDisplayName(), app.GetEmail(), + app.GetPushoverKey(), app.GetSubjectTemplate(), + app.GetTextBodyTemplate(), app.GetHtmlBodyTemplate(), + now).Scan(&app.Id); err != nil { return nil, dao.DBToSentinel(err) } @@ -47,7 +48,7 @@ func (d *DAO) Read(ctx context.Context, appID, orgID string) (*api.App, error) { app := &api.App{} var createdAt, updatedAt time.Time - if err := d.pg.QueryRowContext(ctx, readApp, appID, orgID).Scan(&app.Id, + if err := d.ro.QueryRowContext(ctx, readApp, appID, orgID).Scan(&app.Id, &app.OrgId, &app.Name, &app.DisplayName, &app.Email, &app.PushoverKey, &app.SubjectTemplate, &app.TextBodyTemplate, &app.HtmlBodyTemplate, &createdAt, &updatedAt); err != nil { @@ -76,10 +77,11 @@ func (d *DAO) Update(ctx context.Context, app *api.App) (*api.App, error) { updatedAt := time.Now().UTC().Truncate(time.Microsecond) app.UpdatedAt = timestamppb.New(updatedAt) - if err := d.pg.QueryRowContext(ctx, updateApp, app.GetName(), app.GetDisplayName(), - app.GetEmail(), app.GetPushoverKey(), app.GetSubjectTemplate(), app.GetTextBodyTemplate(), - app.GetHtmlBodyTemplate(), updatedAt, app.GetId(), app.GetOrgId()).Scan( - &createdAt); err != nil { + if err := d.rw.QueryRowContext(ctx, updateApp, app.GetName(), + app.GetDisplayName(), app.GetEmail(), app.GetPushoverKey(), + app.GetSubjectTemplate(), app.GetTextBodyTemplate(), + app.GetHtmlBodyTemplate(), updatedAt, app.GetId(), + app.GetOrgId()).Scan(&createdAt); err != nil { return nil, dao.DBToSentinel(err) } @@ -101,7 +103,7 @@ func (d *DAO) Delete(ctx context.Context, appID, orgID string) error { return err } - _, err := d.pg.ExecContext(ctx, deleteApp, appID, orgID) + _, err := d.rw.ExecContext(ctx, deleteApp, appID, orgID) return dao.DBToSentinel(err) } @@ -141,7 +143,7 @@ func (d *DAO) List( ) ([]*api.App, int32, error) { // Run count query. var count int32 - if err := d.pg.QueryRowContext(ctx, countApps, orgID).Scan( + if err := d.ro.QueryRowContext(ctx, countApps, orgID).Scan( &count); err != nil { return nil, 0, dao.DBToSentinel(err) } @@ -162,7 +164,7 @@ func (d *DAO) List( } // Run list query. - rows, err := d.pg.QueryContext(ctx, query, args...) + rows, err := d.ro.QueryContext(ctx, query, args...) if err != nil { return nil, 0, dao.DBToSentinel(err) } diff --git a/pkg/dao/app/dao.go b/pkg/dao/app/dao.go index d19c71f4..64c819c5 100644 --- a/pkg/dao/app/dao.go +++ b/pkg/dao/app/dao.go @@ -8,12 +8,14 @@ import ( // DAO contains functions to query and modify applications in the database. type DAO struct { - pg *sql.DB + rw *sql.DB + ro *sql.DB } // NewDAO instantiates and returns a new DAO. -func NewDAO(pg *sql.DB) *DAO { +func NewDAO(rw *sql.DB, ro *sql.DB) *DAO { return &DAO{ - pg: pg, + rw: rw, + ro: ro, } } diff --git a/pkg/dao/app/main_test.go b/pkg/dao/app/main_test.go index adb3bd32..ff89e092 100644 --- a/pkg/dao/app/main_test.go +++ b/pkg/dao/app/main_test.go @@ -27,7 +27,7 @@ func TestMain(m *testing.M) { log.Fatalf("TestMain dao.NewPgDB: %v", err) } globalOrgDAO = org.NewDAO(pg, nil, 0) - globalAppDAO = NewDAO(pg) + globalAppDAO = NewDAO(pg, pg) os.Exit(m.Run()) } diff --git a/pkg/dao/event/crudl.go b/pkg/dao/event/crudl.go index 2e07c266..e319a088 100644 --- a/pkg/dao/event/crudl.go +++ b/pkg/dao/event/crudl.go @@ -22,9 +22,9 @@ func (d *DAO) Create(ctx context.Context, event *api.Event) error { now := time.Now().UTC().Truncate(time.Microsecond) event.CreatedAt = timestamppb.New(now) - _, err := d.pg.ExecContext(ctx, createEvent, event.GetOrgId(), event.GetAppId(), - event.GetIdentityId(), event.GetStatus().String(), event.GetError(), now, - event.GetTraceId()) + _, err := d.rw.ExecContext(ctx, createEvent, event.GetOrgId(), + event.GetAppId(), event.GetIdentityId(), event.GetStatus().String(), + event.GetError(), now, event.GetTraceId()) return dao.DBToSentinel(err) } @@ -42,7 +42,7 @@ ORDER BY created_at DESC func (d *DAO) List( ctx context.Context, orgID, identityID string, end, start time.Time, ) ([]*api.Event, error) { - rows, err := d.pg.QueryContext(ctx, listEvents, orgID, identityID, end, + rows, err := d.ro.QueryContext(ctx, listEvents, orgID, identityID, end, start) if err != nil { return nil, dao.DBToSentinel(err) @@ -148,7 +148,7 @@ func (d *DAO) Latest(ctx context.Context, orgID, appID, identityID string) ( query += latestEventsOrder // Run latest query. - rows, err := d.pg.QueryContext(ctx, query, args...) + rows, err := d.ro.QueryContext(ctx, query, args...) if err != nil { return nil, dao.DBToSentinel(err) } diff --git a/pkg/dao/event/dao.go b/pkg/dao/event/dao.go index 7dd213ac..a7d41335 100644 --- a/pkg/dao/event/dao.go +++ b/pkg/dao/event/dao.go @@ -7,12 +7,14 @@ import ( // DAO contains functions to create and query events in the database. type DAO struct { - pg *sql.DB + rw *sql.DB + ro *sql.DB } // NewDAO instantiates and returns a new DAO. -func NewDAO(pg *sql.DB) *DAO { +func NewDAO(rw *sql.DB, ro *sql.DB) *DAO { return &DAO{ - pg: pg, + rw: rw, + ro: ro, } } diff --git a/pkg/dao/event/main_test.go b/pkg/dao/event/main_test.go index 1aaa4ab6..7c9b5e8e 100644 --- a/pkg/dao/event/main_test.go +++ b/pkg/dao/event/main_test.go @@ -27,7 +27,7 @@ func TestMain(m *testing.M) { log.Fatalf("TestMain dao.NewPgDB: %v", err) } globalOrgDAO = org.NewDAO(pg, nil, 0) - globalEvDAO = NewDAO(pg) + globalEvDAO = NewDAO(pg, pg) os.Exit(m.Run()) } diff --git a/pkg/dao/identity/crudl.go b/pkg/dao/identity/crudl.go index 54fec611..6971a7bd 100644 --- a/pkg/dao/identity/crudl.go +++ b/pkg/dao/identity/crudl.go @@ -56,11 +56,12 @@ func (d *DAO) Create(ctx context.Context, identity *api.Identity) ( } } - if err := d.pg.QueryRowContext(ctx, createIdentity, identity.GetOrgId(), - identity.GetAppId(), identity.GetComment(), identity.GetStatus().String(), - otp.Algorithm, hashCryptoToAPI[otp.Hash].String(), otp.Digits, - secretEnc, meta.phone, meta.pushoverKey, meta.email, meta.backupCodes, - answerEnc, now).Scan(&identity.Id); err != nil { + if err := d.rw.QueryRowContext(ctx, createIdentity, identity.GetOrgId(), + identity.GetAppId(), identity.GetComment(), + identity.GetStatus().String(), otp.Algorithm, + hashCryptoToAPI[otp.Hash].String(), otp.Digits, secretEnc, meta.phone, + meta.pushoverKey, meta.email, meta.backupCodes, answerEnc, + now).Scan(&identity.Id); err != nil { return nil, nil, false, dao.DBToSentinel(err) } @@ -86,7 +87,7 @@ func (d *DAO) Read(ctx context.Context, identityID, orgID, appID string) ( var secretEnc, answerEnc []byte var createdAt, updatedAt time.Time - if err := d.pg.QueryRowContext(ctx, readIdentity, identityID, orgID, + if err := d.ro.QueryRowContext(ctx, readIdentity, identityID, orgID, appID).Scan(&identity.Id, &identity.OrgId, &identity.AppId, &identity.Comment, &status, &otp.Algorithm, &hash, &otp.Digits, &secretEnc, &meta.phone, &meta.pushoverKey, &meta.email, @@ -138,7 +139,7 @@ func (d *DAO) UpdateStatus( updatedAt := time.Now().UTC().Truncate(time.Microsecond) identity.UpdatedAt = timestamppb.New(updatedAt) - if _, err = d.pg.ExecContext(ctx, updateIdentityStatus, status.String(), + if _, err = d.rw.ExecContext(ctx, updateIdentityStatus, status.String(), updatedAt, identityID, orgID, appID); err != nil { return nil, dao.DBToSentinel(err) } @@ -161,7 +162,7 @@ func (d *DAO) Delete( return err } - _, err := d.pg.ExecContext(ctx, deleteIdentity, identityID, orgID, appID) + _, err := d.rw.ExecContext(ctx, deleteIdentity, identityID, orgID, appID) return dao.DBToSentinel(err) } @@ -218,7 +219,7 @@ func (d *DAO) List( // Run count query. var count int32 - if err := d.pg.QueryRowContext(ctx, cQuery, cArgs...).Scan( + if err := d.ro.QueryRowContext(ctx, cQuery, cArgs...).Scan( &count); err != nil { return nil, 0, dao.DBToSentinel(err) } @@ -247,7 +248,7 @@ func (d *DAO) List( } // Run list query. - rows, err := d.pg.QueryContext(ctx, lQuery, lArgs...) + rows, err := d.ro.QueryContext(ctx, lQuery, lArgs...) if err != nil { return nil, 0, dao.DBToSentinel(err) } diff --git a/pkg/dao/identity/dao.go b/pkg/dao/identity/dao.go index 16fa9c75..71fef3ba 100644 --- a/pkg/dao/identity/dao.go +++ b/pkg/dao/identity/dao.go @@ -8,15 +8,17 @@ import ( // DAO contains functions to create and query identities in the database. type DAO struct { - pg *sql.DB + rw *sql.DB + ro *sql.DB secretKey []byte } // NewDAO instantiates and returns a new DAO. -func NewDAO(pg *sql.DB, secretKey []byte) *DAO { +func NewDAO(rw *sql.DB, ro *sql.DB, secretKey []byte) *DAO { return &DAO{ - pg: pg, + rw: rw, + ro: ro, secretKey: secretKey, } diff --git a/pkg/dao/identity/main_test.go b/pkg/dao/identity/main_test.go index 1a0ea5be..2a9e0682 100644 --- a/pkg/dao/identity/main_test.go +++ b/pkg/dao/identity/main_test.go @@ -35,8 +35,8 @@ func TestMain(m *testing.M) { log.Fatalf("TestMain dao.NewPgDB: %v", err) } globalOrgDAO = org.NewDAO(pg, nil, 0) - globalAppDAO = app.NewDAO(pg) - globalIdentDAO = NewDAO(pg, key) + globalAppDAO = app.NewDAO(pg, pg) + globalIdentDAO = NewDAO(pg, pg, key) os.Exit(m.Run()) } diff --git a/tool/hermes-create/main.go b/tool/hermes-create/main.go index 280e3735..bb08d4df 100644 --- a/tool/hermes-create/main.go +++ b/tool/hermes-create/main.go @@ -167,11 +167,11 @@ func main() { ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second) defer cancel() - appDAO := app.NewDAO(pg) + appDAO := app.NewDAO(pg, pg) app, err := appDAO.Read(ctx, flag.Arg(3), flag.Arg(2)) checkErr(err) - identDAO := identity.NewDAO(pg, identKey) + identDAO := identity.NewDAO(pg, pg, identKey) _, otp, err := identDAO.Read(ctx, flag.Arg(4), flag.Arg(2), flag.Arg(3)) checkErr(err) diff --git a/vendor/github.com/jackc/pgservicefile/.travis.yml b/vendor/github.com/jackc/pgservicefile/.travis.yml deleted file mode 100644 index e176228e..00000000 --- a/vendor/github.com/jackc/pgservicefile/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.x - - tip - -matrix: - allow_failures: - - go: tip diff --git a/vendor/github.com/jackc/pgservicefile/README.md b/vendor/github.com/jackc/pgservicefile/README.md index e50ca126..2fc7e012 100644 --- a/vendor/github.com/jackc/pgservicefile/README.md +++ b/vendor/github.com/jackc/pgservicefile/README.md @@ -1,5 +1,6 @@ -[![](https://godoc.org/github.com/jackc/pgservicefile?status.svg)](https://godoc.org/github.com/jackc/pgservicefile) -[![Build Status](https://travis-ci.org/jackc/pgservicefile.svg)](https://travis-ci.org/jackc/pgservicefile) +[![Go Reference](https://pkg.go.dev/badge/github.com/jackc/pgservicefile.svg)](https://pkg.go.dev/github.com/jackc/pgservicefile) +[![Build Status](https://github.com/jackc/pgservicefile/actions/workflows/ci.yml/badge.svg)](https://github.com/jackc/pgservicefile/actions/workflows/ci.yml) + # pgservicefile diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go index 58c6bfc7..6200876f 100644 --- a/vendor/golang.org/x/sys/unix/fcntl.go +++ b/vendor/golang.org/x/sys/unix/fcntl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build dragonfly || freebsd || linux || netbsd || openbsd +//go:build dragonfly || freebsd || linux || netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go index 0d12c085..dbe680ea 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_linux.go +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) { func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error { return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value)) } + +// IoctlLoopConfigure configures all loop device parameters in a single step +func IoctlLoopConfigure(fd int, value *LoopConfig) error { + return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index cbe24150..6202638b 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -519,6 +519,7 @@ ccflags="$@" $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || + $2 == "LOOP_CONFIGURE" || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ || $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || $2 ~ /^NFC_.*_(MAX)?SIZE$/ || @@ -560,7 +561,7 @@ ccflags="$@" $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || $2 ~ /^CLONE_[A-Z_]+/ || - $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && + $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ && $2 ~ /^(BPF|DLT)_/ || $2 ~ /^AUDIT_/ || $2 ~ /^(CLOCK|TIMER)_/ || diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 6f328e3a..a00c3e54 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -316,7 +316,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { if err != nil { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index a5e1c10e..0f85e29e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -61,15 +61,23 @@ func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) ( } //sys fchmodat(dirfd int, path string, mode uint32) (err error) - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - // Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior - // and check the flags. Otherwise the mode would be applied to the symlink - // destination which is not what the user expects. - if flags&^AT_SYMLINK_NOFOLLOW != 0 { - return EINVAL - } else if flags&AT_SYMLINK_NOFOLLOW != 0 { - return EOPNOTSUPP +//sys fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) + +func Fchmodat(dirfd int, path string, mode uint32, flags int) error { + // Linux fchmodat doesn't support the flags parameter, but fchmodat2 does. + // Try fchmodat2 if flags are specified. + if flags != 0 { + err := fchmodat2(dirfd, path, mode, flags) + if err == ENOSYS { + // fchmodat2 isn't available. If the flags are known to be valid, + // return EOPNOTSUPP to indicate that fchmodat doesn't support them. + if flags&^(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 { + return EINVAL + } else if flags&(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 { + return EOPNOTSUPP + } + } + return err } return fchmodat(dirfd, path, mode) } @@ -1302,7 +1310,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { return "", err } } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index d2882ee0..b25343c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -166,6 +166,20 @@ func Getresgid() (rgid, egid, sgid int) { //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys fcntl(fd int, cmd int, arg int) (n int, err error) +//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) = SYS_FCNTL + +// FcntlInt performs a fcntl syscall on fd with the provided command and argument. +func FcntlInt(fd uintptr, cmd, arg int) (int, error) { + return fcntl(int(fd), cmd, arg) +} + +// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { + _, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk)) + return err +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 60c8142d..21974af0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -158,7 +158,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { if err != nil { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } const ImplementsGetwd = true diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index d99d05f1..b473038c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -1104,7 +1104,7 @@ func GetsockoptString(fd, level, opt int) (string, error) { return "", err } - return string(buf[:vallen-1]), nil + return ByteSliceToString(buf[:vallen]), nil } func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 9c00cbf5..c73cfe2f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -486,7 +486,6 @@ const ( BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_BEFORE = 0x8 BPF_F_ID = 0x20 - BPF_F_LINK = 0x2000 BPF_F_NETFILTER_IP_DEFRAG = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 @@ -1802,6 +1801,7 @@ const ( LOCK_SH = 0x1 LOCK_UN = 0x8 LOOP_CLR_FD = 0x4c01 + LOOP_CONFIGURE = 0x4c0a LOOP_CTL_ADD = 0x4c80 LOOP_CTL_GET_FREE = 0x4c82 LOOP_CTL_REMOVE = 0x4c81 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index faca7a55..1488d271 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -37,6 +37,21 @@ func fchmodat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 88bfc288..a1d06159 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s index 4cbeff17..41b56173 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index b8a67b99..5b2a7409 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s index 1123f275..4019a656 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index af50a65c..f6eda134 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s index 82badae3..ac4af24f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4 DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4 +DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 8fb4ff36..55df20ae 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s index 24d7eecb..f77d5321 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index f469a83e..8c1155cb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s index 9a498a06..fae140b6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go index c26ca2e1..7cc80c58 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s index 1f224aa4..9d1e0ff0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s @@ -213,6 +213,12 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + CALL libc_fcntl(SB) + RET +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 CALL libc_ppoll(SB) RET diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go index bcc920dd..0688737f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go @@ -584,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fcntl(fd int, cmd int, arg int) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fcntl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) { + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s index 87a79c70..da115f9a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s @@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ppoll(SB) GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 997bcd55..bbf8399f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -2671,6 +2671,7 @@ const ( BPF_PROG_TYPE_LSM = 0x1d BPF_PROG_TYPE_SK_LOOKUP = 0x1e BPF_PROG_TYPE_SYSCALL = 0x1f + BPF_PROG_TYPE_NETFILTER = 0x20 BPF_CGROUP_INET_INGRESS = 0x0 BPF_CGROUP_INET_EGRESS = 0x1 BPF_CGROUP_INET_SOCK_CREATE = 0x2 @@ -2715,6 +2716,11 @@ const ( BPF_PERF_EVENT = 0x29 BPF_TRACE_KPROBE_MULTI = 0x2a BPF_LSM_CGROUP = 0x2b + BPF_STRUCT_OPS = 0x2c + BPF_NETFILTER = 0x2d + BPF_TCX_INGRESS = 0x2e + BPF_TCX_EGRESS = 0x2f + BPF_TRACE_UPROBE_MULTI = 0x30 BPF_LINK_TYPE_UNSPEC = 0x0 BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1 BPF_LINK_TYPE_TRACING = 0x2 @@ -2725,6 +2731,18 @@ const ( BPF_LINK_TYPE_PERF_EVENT = 0x7 BPF_LINK_TYPE_KPROBE_MULTI = 0x8 BPF_LINK_TYPE_STRUCT_OPS = 0x9 + BPF_LINK_TYPE_NETFILTER = 0xa + BPF_LINK_TYPE_TCX = 0xb + BPF_LINK_TYPE_UPROBE_MULTI = 0xc + BPF_PERF_EVENT_UNSPEC = 0x0 + BPF_PERF_EVENT_UPROBE = 0x1 + BPF_PERF_EVENT_URETPROBE = 0x2 + BPF_PERF_EVENT_KPROBE = 0x3 + BPF_PERF_EVENT_KRETPROBE = 0x4 + BPF_PERF_EVENT_TRACEPOINT = 0x5 + BPF_PERF_EVENT_EVENT = 0x6 + BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_UPROBE_MULTI_RETURN = 0x1 BPF_ANY = 0x0 BPF_NOEXIST = 0x1 BPF_EXIST = 0x2 @@ -2742,6 +2760,8 @@ const ( BPF_F_MMAPABLE = 0x400 BPF_F_PRESERVE_ELEMS = 0x800 BPF_F_INNER_MAP = 0x1000 + BPF_F_LINK = 0x2000 + BPF_F_PATH_FD = 0x4000 BPF_STATS_RUN_TIME = 0x0 BPF_STACK_BUILD_ID_EMPTY = 0x0 BPF_STACK_BUILD_ID_VALID = 0x1 @@ -2762,6 +2782,7 @@ const ( BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_DONT_FRAGMENT = 0x4 BPF_F_SEQ_NUMBER = 0x8 + BPF_F_NO_TUNNEL_KEY = 0x10 BPF_F_TUNINFO_FLAGS = 0x10 BPF_F_INDEX_MASK = 0xffffffff BPF_F_CURRENT_CPU = 0xffffffff @@ -2778,6 +2799,8 @@ const ( BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20 BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40 + BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 0x80 + BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 0x100 BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_F_SYSCTL_BASE_NAME = 0x1 @@ -2866,6 +2889,8 @@ const ( BPF_DEVCG_DEV_CHAR = 0x2 BPF_FIB_LOOKUP_DIRECT = 0x1 BPF_FIB_LOOKUP_OUTPUT = 0x2 + BPF_FIB_LOOKUP_SKIP_NEIGH = 0x4 + BPF_FIB_LOOKUP_TBID = 0x8 BPF_FIB_LKUP_RET_SUCCESS = 0x0 BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 @@ -2901,6 +2926,7 @@ const ( BPF_CORE_ENUMVAL_EXISTS = 0xa BPF_CORE_ENUMVAL_VALUE = 0xb BPF_CORE_TYPE_MATCHES = 0xc + BPF_F_TIMER_ABS = 0x1 ) const ( @@ -2979,6 +3005,12 @@ type LoopInfo64 struct { Encrypt_key [32]uint8 Init [2]uint64 } +type LoopConfig struct { + Fd uint32 + Size uint32 + Info LoopInfo64 + _ [8]uint64 +} type TIPCSocketAddr struct { Ref uint32 diff --git a/vendor/modules.txt b/vendor/modules.txt index f0d97f73..ae756fad 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -39,7 +39,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/utilities # github.com/jackc/pgpassfile v1.0.0 ## explicit; go 1.12 github.com/jackc/pgpassfile -# github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a +# github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 ## explicit; go 1.14 github.com/jackc/pgservicefile # github.com/jackc/pgx/v5 v5.5.0 @@ -103,12 +103,12 @@ github.com/stretchr/testify/require # go.uber.org/mock v0.3.0 ## explicit; go 1.20 go.uber.org/mock/gomock -# golang.org/x/crypto v0.15.0 +# golang.org/x/crypto v0.16.0 ## explicit; go 1.18 golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish golang.org/x/crypto/pbkdf2 -# golang.org/x/net v0.18.0 +# golang.org/x/net v0.19.0 ## explicit; go 1.18 golang.org/x/net/http/httpguts golang.org/x/net/http2 @@ -120,7 +120,7 @@ golang.org/x/net/trace ## explicit; go 1.18 golang.org/x/sync/semaphore golang.org/x/sync/singleflight -# golang.org/x/sys v0.14.0 +# golang.org/x/sys v0.15.0 ## explicit; go 1.18 golang.org/x/sys/unix # golang.org/x/text v0.14.0 @@ -138,15 +138,15 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 +# google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 ## explicit; go 1.19 google.golang.org/genproto/internal -# google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 +# google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 ## explicit; go 1.19 google.golang.org/genproto/googleapis/api google.golang.org/genproto/googleapis/api/annotations google.golang.org/genproto/googleapis/api/httpbody -# google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 ## explicit; go 1.19 google.golang.org/genproto/googleapis/rpc/status # google.golang.org/grpc v1.59.0